Forum: Cfengine Help
Subject: Re: conditional command execution
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,20520,20524#msg-20524

It's exactly as Neil and Frans said, with the exception that AFAIK 
classes_satisfied does not exist.

My 0.02: For simple "define if repaired/failed/satisfied/etc" cases like this, 
I like to use the if_* body parts included in the cfengine_stdlib.cf 
(http://www.cfengine.org/pages/starterkit ), since I think it makes the intent 
clearer. Using this, your example would become:

"/etc/ssh/sshd_config"
  perms => mog("644", "root", "wheel"),
  copy_from => secure_cp("$(g.masterfiles)/config/etc/ssh/sshd_config", 
"$(g.phost)");
  classes => if_repaired("restart_sshd");

commands:
  restart_sshd::
    "/etc/init.d/sshd restart"


(shameless plug) May I also point you to an sshd-configuration snippet I wrote, 
which may dispense with the need to copy files and make the intent even clearer 
by specifying the parameters to set.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to