verbose: Could not resolve expected list variable 'cmdb' in function 'format'

15 views
Skip to first unread message

Christian Linden

unread,
Dec 28, 2016, 8:35:33 AM12/28/16
to help-cfengine
Hi,

getting this in the -v output of the agent.
 verbose: Could not resolve expected list variable 'cmdb' in function 'format'
 verbose: format() with %S specifier needs a data container or a list instead of 'cmdb'.
 verbose: Could not resolve expected list variable 'cmdb' in function 'format'
 verbose: format() with %S specifier needs a data container or a list instead of 'cmdb'.
 verbose: Could not resolve expected list variable 'cmdb' in function 'format'
 verbose: format() with %S specifier needs a data container or a list instead of 'cmdb'.
 verbose: Begin Parsing file '/var/cfengine/inputs/inventory/linux.cf'
 verbose: End Parsing file '/var/cfengine/inputs/inventory/linux.cf'


What is it about?

Thanks,
Chris

Nick Anderson

unread,
Dec 28, 2016, 12:26:23 PM12/28/16
to Christian Linden, help-cfengine

Hi Chris,

I think it's just some noise that can be suppressed with a couple minor
modifications.

Try this patch:

modified   inventory/any.cf
@@ -787,8 +787,13 @@ bundle agent inventory_cmdb_load(file)
       "$(ckeys)" expression => "any", scope => "namespace";

   vars:
-      "cmdb" data => readjson($(file), "999999");
-      "cmdb_string" string => format("%S", cmdb);
+      "cmdb"
+        data => readjson($(file), "999999"),
+        ifvarclass => fileexists( $(file) );
+
+      "cmdb_string"
+        string => format("%S", cmdb),
+        ifvarclass => isvariable( cmdb );

       "bkeys" slist => getindices("cmdb[vars]");
       "vkeys_$(bkeys)" slist => getindices("cmdb[vars][$(bkeys)]");

Let me know if it squelches your undesired messages.


Nick Anderson
Doer of things, CFEngine

Christian Linden

unread,
Dec 29, 2016, 10:20:59 AM12/29/16
to help-cfengine, lindo...@gmail.com
yes, thanks =)
Reply all
Reply to author
Forward
0 new messages