Forum: CFEngine Help Subject: Re: Forcing variable evaluation after file promises Author: phnakarin Link to topic: https://cfengine.com/forum/read.php?3,27031,27033#msg-27033
I'm thinking about using fileexists() to create a class before readfile() and edit_line. For instance; vars: have_key:: "key[$(keys)]" string => readfile("$(keystore)/$(keys).pub", "1024"); classes: any:: "have_key" expression => fileexists("$(keystore)/$(keys).pub"); files: have_key:: "$(u_home)/.ssh/authorized_keys" comment => "Add defined keys to the authorized_keys file", create => "true", perms => mog("0600", "$(u)", "$(u)"), edit_line => append_if_no_line("$(key[$(keys)])"); I don't try the code, but I think it should get rid of null value in $(key). Cheers, -- Nakarin _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine