Hmm, edit_field has this:

7.6.1 edit_field (compound body)

Type: (ext body)

"allow_blank_fields"

It seems like getfields needs a similar knob, if one doesn't already exist.

On Tue, Dec 15, 2009 at 10:47 AM, Matt Richards <defraya...@gmail.com> wrote:
> 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
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to