Forum: Cfengine Help
Subject: this.promiser not expanding in edit_line bundle
Author: reverb
Link to topic: https://cfengine.com/forum/read.php?3,17811,17811#msg-17811

I was trying to follow the example for distributing SSH keys from the solution 
guide (http://www.cfengine.org/manuals/cf3-solutions.html#Distribute-ssh-keys), 
and I noticed that the have_user class wasn't being dynamically added, even 
though it should have because I had a slightly different key in the 
authorized_keys file already.  I wrote a bundle to test it a little differently 
and it looks like $(this.promiser) isn't expanding to the file from the promise 
in the main bundle:

$ cat /tmp/foofile
foo bar baz wow

body common control
{
bundlesequence => { "test" };
}

bundle agent test
{

files:
    "/tmp/foofile"
        edit_line => insert_file_if_no_line_matching;
}

bundle edit_line insert_file_if_no_line_matching {

    classes:
        "match_found_promiser" expression => 
regline(".*baz.*","$(this.promiser)");
        "match_found_realvalue" expression => regline(".*baz.*","/tmp/foofile");

    reports:
        match_found_promiser::
            "match found promiser";
        match_found_realvalue::
            "match found realvalue";
}

$ cf-agent -b test -f ./test.cf -I -K
 >> Using command line specified bundlesequence
R: match found realvalue

Using 3.0.5p1 community RPM.  Am I missing something or is the example in the 
solutions wrong?

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to