Forum: Cfengine Help
Subject: any other action from changes besides reporting?
Author: Seva Gluschenko
Link to topic: https://cfengine.com/forum/read.php?3,17150,17150#msg-17150

Hello folks,

Is there any method to trigger an action upon file change? My current 
experiments with body changes show that changing file content doesn't trigger 
if_repaired call, e.g.


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

bundle agent testing
{
 files:
 "/tmp/1"
        classes => if_repaired("fixed"),
        changes => detect;

  reports:
    fixed::
        "got it";
}

body changes detect
{
        hash => "md5";
        update_hashes => "true";
        report_changes => "content";
}

body classes if_repaired(x)
{
 promise_repaired => { "$(x)" };
}


results in following output once the file "/tmp/1" is changed:


cf3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cf3 ALERT: Hash (md5) for /tmp/1 changed!
cf3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cf3  -> Updating cryptohash for /tmp/1 to MD5=5bbf5a52328e7439ae6e719dfe712200
cf3  -> New persistent state checksum_alerts



but "fixed" class is not set.  Any ideas?

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

Reply via email to