Forum: CFEngine Help Subject: Re: unit_root_passwd.cf Author: bahamat Link to topic: https://cfengine.com/forum/read.php?3,26164,26167#msg-26167
Ok, I tested this stripped down: bundle agent pass { vars: "gotpw" int => readstringarray("pw","/tmp/pw.txt","#[^\n]*",":","3","200"); reports: cfengine:: "pw is $(pw[1])"; } If in /tmp/pw.txt I have this (which is what the comments in the promise say it should be): root:foo: then I get this: R: pw is foo If in /tmp/pw.txt I have this (which is what you said is in your file): :foo: then I get this: R: pw is $(pw[1]) So it looks like there's nothing wrong with your promises. It's the file you're reading from that is wrong. I would also suggest that your edit_field promise be changed from this: edit_field => col(":","2","$(pw[1])","set"); to this: edit_field => col(":","2","$(pw[$(user)][1])","set"); Then you can change the password for any user when calling that bundle. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine