Forum: Cfengine Help
Subject: Re: Warning email on promise not kept
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,21497,21499#msg-21499

This works.
$ cat warn-only.cf 
body common control
{
bundlesequence => { "test" };
inputs => { "cfengine_stdlib.cf"};
}

bundle agent test 
{

        files:
                "/home/nwatson/.ssh/."
                perms => m( "0770" ),
                action => warn_now,
                classes => cdefine( 
                        "mode_kept",
                        "mode_repaired",
                        "mode_failed"
                );

        reports:

                !mode_kept::
                        "/home/nwatson/.ssh/. mode need changing!";
}
body action warn_now{
    action_policy => "warn";
    background => "true";
}
body classes cdefine (k,r,f){
    promise_kept => {canonify("${k}")};
    promise_repaired => {canonify("${r}")};
    repair_failed => {canonify("${f}")};
}

$ ls -al /home/nwatson/.ssh/
total 12
drwx------  2 nwatson essi 4096 Dec 22  2009 .
drwx------ 19 nwatson essi 4096 Apr 13 08:49 ..
-rw-r--r--  1 nwatson essi 3228 Mar  5  2010 known_hosts

$ cf-agent -Kf ./warn-only.cf 
 !! /home/nwatson/.ssh has permission 700 - 
I: Made in version 'not specified' of './warn-only.cf' near line 12
R: /home/nwatson/.ssh/. mode need changing!
 !! /home/nwatson/.ssh has permission 700 - 
I: Made in version 'not specified' of './warn-only.cf' near line 12


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

Reply via email to