I am looking at getfields and it seems that if you have a null field, the value 
in the named array is not populated for that entry. For example:


bundle agent test {

   vars:

    "passwd_match" int  => getfields("^root:.*","/tmp/testfile",":","userdata");

   reports:

     cfengine_3::
      "home dir for $(userdata[1]) is $(userdata[5])";


}

# cat /tmp/testfile:
root:!:0:0:GECOS:/:/usr/bin/sh

The result is
R: home dir for root is GECOS

Now, if you remove the GECOS field:
# cat /tmp/testfile
root:!:0:0::/:/usr/bin/sh

The result is:
R: home dir for root is /

Is this the expected behavior?
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to