Forum: Cfengine Help Subject: Re: How to modify a global list Author: jonb1987 Link to topic: https://cfengine.com/forum/read.php?3,21589,21603#msg-21603
OK, thanks to all for hints. Here's what I've done, which is the cleanest and most generic way I've found so far - comments/criticisms gratefully received! (Note: not all bodies/bundles are included for brevity) #---------------------------------------------------------- bundle agent cfengine { #---------------------------------------------------------- vars: "crontab" string => "/etc/crontab"; files: # Check cf-execd and schedule is in crontab "$(crontab)" -> "sysadmin" comment => "Add cfengine as a cron job", edit_line => upgrade_cfexecd, classes => if_repaired("reload_cron") ; } #---------------------------------------------------------- body classes if_repaired(newclass) { #---------------------------------------------------------- promise_repaired => { "$(newclass)" }; } #---------------------------------------------------------- bundle agent services { #---------------------------------------------------------- vars: "services_string" string => execresult("/sbin/chkconfig -t | awk '{print $1}'", "useshell"); "services" slist => splitstring("$(services_string)", "\s+", "999"), comment => "Set services to $(services_string)"; commands: "/sbin/service $(services) reload" -> "sysadmin" comment => "Reload $(services) daemon", ifvarclass => canonify("reload_$(services)"); } _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine