Forum: Cfengine Help
Subject: reporting repairs
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,19478,19478#msg-19478

Hi Folks,

Previously Community edition users were resorting to logging repairs at a per 
promise level.  I've been using methods to make a promise and report its 
status.  For example:

    methods:

        Linux|SunOS_5_10|AIX::

            "any" usebundle => filecontents_active( 
                "/etc/warning",
                "${g.masterfiles}/config/profiles/warning",
                );  
....
bundle agent filecontents_active(trg, src){
# Bundle to copy files 

    files:
        "${trg}"
            copy_from => remote_cp("${src}","${g.phost}"),
            action => warn_now, # Passive only
            classes => cdefine(
                "${trg}_copy_kept",
                "${trg}_copy_repaired",
                "${trg}_copy_failed"
            ),
            comment => "Copy ${trg}";

    reports:

        all::
            "${g.pr} ${trg} fixed contents.",
            ifvarclass => canonify("${trg}_copy_repaired");

            "${g.pk} ${trg} correct contents.",
            ifvarclass => canonify("${trg}_copy_kept");

            "${g.pf} ${trg} wrong contents.",
            ifvarclass => canonify("${trg}_copy_failed");
}


This shortens my policy and reports to outputs any actions CF may take.  How 
are others doing this?

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

Reply via email to