cf3 readstringarray filename from edit_line parameters

Matt Richards <[email protected]> Tue, 7 Apr 2009 14:49:05 -0400
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <[email protected]>
Here is an odd one. It seem like the file in readstringarray is
checked right away, instead of waiting for bundle to resolve the
parameter:

###

bundle agent foo {

     "/etc/foo"
          edit_line => delete_users("$(sys.workdir)/userfile");

}

###
bundle edit_line delete_users(filename) {

  vars:

   "userarray"  int   =>
readstringarray("users","$(filename)","#[^\n]*",":",100,40000);
   "user_list"  slist => getindices("users");

   delete_lines:
     "^$(user_list):.*";

}

# cf-agent -Kv

...

cf3 Could not examine file $(filename) in readfile
cf3 (stat: No such file or directory)
cf3 Could not examine file $(filename) in readfile
cf3 (stat: No such file or directory)
cf3 Initiate variable convergence...
cf3 Could not examine file $(filename) in readfile
cf3 (stat: No such file or directory)
cf3 Initiate control variable converge