Forum: Cfengine Help Subject: Weird unset variable warning? Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,21129,21129#msg-21129
I'm seeing this error regularly, and while everything actually works fine, the error is bugging me. !! Unresolved variables in rval of "find_arg" in scope app_webmin Here's a bundle which leads to the error: # cat /tmp/test.cf body common control { bundlesequence => { "example" }; } bundle agent example { vars: linux:: "find_path" string => "/usr/bin/find"; "fn_arg" string => "-iname"; !linux:: "find_path" string => "/bin/find"; "fn_arg" string => "-name"; any:: "server_root" string => "/tmp"; "extensions" slist => { "*.pl", "*.cgi", "*.cf" }; # if we have more than one extension, join those with "-o -name" then # put a -name in front of the list, which should still work with just 1 "fn_ext_arg" string => join( " -o $(fn_arg) ", "extensions" ); "find_arg" string => "$(server_root) $(fn_arg) $(fn_ext_arg)"; "executable_list" slist => { @(find2array.executable_list) }; commands: "/var/cfengine/modules/find2array executable_list $(find_arg)" comment => "Build array of executables", handle => "build_exec_list", module => "true"; reports: linux|!linux:: "Found $(executable_list)"; } And here's what I get when I run it: # cf-agent -IK -f /tmp/test.cf !! Unresolved variables in rval of "find_arg" in scope example -> Executing '/var/cfengine/modules/find2array executable_list /tmp -iname *.pl -o -iname *.cgi -o -iname *.cf' ...(timeout=-678,owner=-1,group=-1) M "/var/cfengine/modules/find2array executable_list /tmp -iname *.pl -o -iname *.cgi -o -iname *.cf": -> Completed execution of /var/cfengine/modules/find2array executable_list /tmp -iname *.pl -o -iname *.cgi -o -iname *.cf R: Found /tmp/sendmail.cf R: Found /tmp/test.cf I think that it's complaining about the fn_ext_arg variable since it's the result of a join, but I can't see why that would cause a problem. I tried replacing any with the hostname, and doing a hostname& in front of the linux/!linux, but that had no impact. Replacing the join with a fixed string, though, makes the warning go away. Can someone with more knowledge of "how cfengine resolves variables" maybe clue me in as to what's happening here? I really dont like seeing warnings, particularly when everything's actually ok. Also, if there's a way to make the module protocol accept longer strings (so I can return larger arrays), I'd appreciate hearing about it. :) _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine