error: In attribute 'servers', Scalar value is out of range

80 views
Skip to first unread message

Neil Watson

unread,
Oct 9, 2014, 2:36:44 PM10/9/14
to help-cfengine
I'm getting this error in 3.5.2:

/var/cfengine/inputs/library.cf:884:0: error: In attribute 'servers',
Scalar value is out of range

There is no line 884 and there is no other context in the error message,
before or after. Any ideas how to find out the line where the problem
is? The only servers attributes in that file are:

/masterfiles$ grep -C3 servers library.cf
body copy_from amd_dcp_encrypt(from, server)
{
source => "${from}";
servers => { "${server}" };
encrypt => "yes";
compare => "digest";
}

--
body copy_from trust_secure_cp(from,server)
{
source => "$(from)";
servers => { "$(server)" };
compare => "digest";
trustkey => "true";
encrypt => "true";

--
"${cache_file}"
comment => "Cache source file",
handle => "rmt_edit_template_files_cache",
copy_from => remote_dcp( "${src}", "@{ps.policy_servers}" );

"${dest}"
comment => "Promise contents from template",

Actual error, which comes from cf-agent. Cf-promises reports no error.

cf3> -> Negated classes = {}
/var/cfengine/inputs/library.cf:884:0: error: In attribute 'servers', Scalar value is out of range
Fatal CFEngine error: Cannot continue

--
Neil H Watson
Sr. Partner, Architecture and Infrastructure
CFEngine reporting: https://github.com/evolvethinking/delta_reporting
CFEngine policy: https://github.com/evolvethinking/evolve_cfengine_freelib
CFEngine and vim: https://github.com/neilhwatson/vim_cf3
CFEngine support: http://evolvethinking.com

The BSD Dreamer

unread,
Oct 9, 2014, 6:21:50 PM10/9/14
to help-c...@googlegroups.com
My fuzzy memory says there was a way to pass a list to a scalar, but maybe I
was dreaming....

Using "${ps.policy_servers}" is probably the wrong kind of iteration here...so
does that mean mean a new body like:

body copy_from remote_dcps(from, servers)
{
source => "${from}";
servers => { "@{servers}" };
compare => "digest";
}



--
Email: bea...@tardisi.com Name: Lawrence "The Dreamer" Chen
GitHub: https://github.com/TheDreamer Pages: http://beastie.tardisi.com
Blog: http://lawrencechen.net WWW: http://tardisi.com

Dimitrios Apostolou

unread,
Oct 10, 2014, 5:41:56 AM10/10/14
to The BSD Dreamer, help-c...@googlegroups.com
Yes, I agree that @-expansion is the correct one here, hopefully it
fixes the issue!

Nevertheless getting an error message at a non-existent line is a bug
by itself. Neil, are you getting such an error message in 3.6 as well?


Dimitris
> --
> You received this message because you are subscribed to the Google Groups "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
> To post to this group, send email to help-c...@googlegroups.com.
> Visit this group at http://groups.google.com/group/help-cfengine.
> For more options, visit https://groups.google.com/d/optout.

Neil Watson

unread,
Oct 10, 2014, 9:27:10 AM10/10/14
to help-c...@googlegroups.com
On Thu, Oct 09, 2014 at 05:21:46PM -0500, The BSD Dreamer wrote:
>> copy_from => remote_dcp( "${src}", "@{ps.policy_servers}" );
>>
>> "${dest}"
>> comment => "Promise contents from template",
>>
>> Actual error, which comes from cf-agent. Cf-promises reports no error.
>>
>> cf3> -> Negated classes = {}
>> /var/cfengine/inputs/library.cf:884:0: error: In attribute 'servers', Scalar
>> value is out of range
>> Fatal CFEngine error: Cannot continue
>>
>
>My fuzzy memory says there was a way to pass a list to a scalar, but maybe I
>was dreaming....
>
>Using "${ps.policy_servers}" is probably the wrong kind of iteration here...so
>does that mean mean a new body like:
>
>body copy_from remote_dcps(from, servers)
>{
>source => "${from}";
>servers => { "@{servers}" };
>compare => "digest";
>}

It's possible that the line 884 is referring to the file where
remote_dcp body is (lib/3.5/files.cf). That line is

body copy_from remote_dcp(from,server) # line 884
{
servers => { "$(server)" };
source => "$(from)";
compare => "digest";
}

But, I still don't see why this is an error. I pass @{list} to other
copy_from bodies without errors. Look at this example:

body common control
{
bundlesequence => { "main", };
}

bundle agent main
{
vars:
"servers" slist => { "172.16.0.2", "172.16.0.3" };

methods:
"any" usebundle => test;
}

bundle agent test
{
files:
"/tmp/nhw.test1"
comment => "List does not exist!",
copy_from => remote_dcp( "/tmp/bar", "@(main.server)" );
"/tmp/nhw.test3"
copy_from => remote_dcp( "/tmp/bar", "@{main.servers}" );

}

body copy_from remote_dcp(from,server)
{
servers => { "$(server)" };
source => "$(from)";
compare => "digest";
}

This does not produce an error like the one in my original post, even with the
intentional non existing slist.

Neil Watson

unread,
Oct 10, 2014, 10:57:45 AM10/10/14
to help-c...@googlegroups.com
On Thu, Oct 09, 2014 at 05:21:46PM -0500, The BSD Dreamer wrote:
>body copy_from remote_dcps(from, servers)
>{
>source => "${from}";
>servers => { "@{servers}" };
>compare => "digest";

What to you propose for the servers parameter on the bundle side? I
tried what you have, but the error persists, and I cannot reproduce it
standalone.

"${cache_file}"
comment => "Cache source file",
handle => "rmt_edit_template_files_cache",
copy_from => remote_dcps( "${src}", "@{ps.policy_servers}" );
}

body copy_from remote_dcps(from, policy_servers)
# Work around for odd bug. Neil
{
servers => { "@{policy_servers}" };
source => "$(from)";
compare => "digest";
}

Neil Watson

unread,
Oct 14, 2014, 9:13:28 AM10/14/14
to help-cfengine
Got this from the debug output, but I don't know how to interpret it.
Any ideas:

2014-10-14T08:52:30-0400 debug: Found 0 variables in 'ps.policy_servers'
2014-10-14T08:52:30-0400 debug: Aggregate result '172.26.2.4', scanning at '' (current delta '172.26.2.4')
2014-10-14T08:52:30-0400 debug: Returning complete scalar expansion ('172.26.2.4' => '172.26.2.4')
2014-10-14T08:52:30-0400 error: /var/cfengine/inputs/library.cf:148:0: error: In attribute 'servers', Scalar value is out of range

2014-10-14T08:52:30-0400 error: Fatal CFEngine error: Cannot continue

143 body copy_from remote_dcps(from, policy_servers)
144 # Work around for odd bug. Neil
145 {
146 source => "$(from)";
147 compare => "digest";
148 servers => { "@{policy_servers}" };
149 }

Neil Watson

unread,
Oct 14, 2014, 1:23:10 PM10/14/14
to help-cfengine
I think I figured this out. My theory is that the process that populates
ps.policy_servers create list item with all white space characters that
the servers attribute balked on. This whole hair pulling mess could have
been avoided if cf-agent's error message showed the value it was
objecting to encased in a delimiter.

In Perl I often do messages like "Can't open file [$file]" so I know
everything that is $file is between [ and ], including white space.
Reply all
Reply to author
Forward
0 new messages