Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: sqlerror on November 02, 2004, 08:44:30 AM

Title: Templatefragment warnings at "if ($type eq 'user')"
Post by: sqlerror on November 02, 2004, 08:44:30 AM
When expanding templates that retrieve the usernames from /home/e-smith/accounts a warning is given. As an example I created a template /etc/e-smith/templates-custom/root/test.txt that merely lists existing users. The output does seem to be correct, but the warningmessage points out something is not functioning as it should:

[root@meterkast test.txt]# /sbin/e-smith/expand-template /root/test.txt
WARNING in /etc/e-smith/templates-custom//root/test.txt/10test: Use of uninitialized value in string eq at /etc/e-smith/templates//root/test.txt/10test line 18.
WARNING: Template processing succeeded for //root/test.txt: 1 fragment generated warnings
 at /sbin/e-smith/expand-template line 49

Contents of the template: /etc/e-smith/templates-custom/root/test.txt/10test:

Code: [Select]
{
# This script lists all known users on the server.
# But generates an warning at line if ($type eq 'user')
# output is correct though
}

{
my %accounts;
tie %accounts, 'esmith::config', '/home/e-smith/accounts';

my $key;
my $value;
$OUT .= "users:";

while (($key,$value) = each %accounts)
{
my ($type, %properties) = split (/\|/, $value, -1);
if ($type eq 'user')
{
$OUT .= " " . $key;
}
}
}



Is there a fault in the accounts file or should the expand-template script be checked?

Greetings,

sqlerror
Title: Re: Templatefragment warnings at "if ($type eq 'user')&
Post by: sqlerror on November 03, 2004, 11:08:07 PM
Well, found an error in the /home/e-smith/accounts file:

Code: [Select]
i-bay|PasswordSet|no|Passwordable|no|PublicAccess|global|Removable|no|UserAccess|wr-admin-rd-group=


Removing this line, fixed the expand-template warnings.

Still wonder how this line came in....

Sqlerror