Not sure what you mean by "iteration problems", but here's something
similar that I use to ensure only a specific list of services are enabled
for runlevel 3 in CentOS.
HTH
Steve
------------------
bundle agent chkconfig {
vars:
# This is all that should be enabled at runlevel 3
"runlvl3_policy" slist => {
"acpid",
"auditd",
"autofs",
"cfengine3",
"cpuspeed",
"crond",
"firstboot",
"haldaemon",
"httpd",
"iptables",
"irqbalance",
"mcstrans",
"mdmonitor",
"messagebus",
"microcode_ctl",
"network",
"ntpd",
"rawdevices",
"readahead_early",
"restorecond",
"sendmail",
"smartd",
"sshd",
"syslog",
"sysstat"
};
"runlvl3_sys_str" string => execresult("/sbin/chkconfig
--list|grep
'3:on'|cut -f 1","useshell");
"runlvl3_sys_list" slist =>
splitstring("$(runlvl3_sys_str)","[\s]+","50");
classes:
"kill_$(runlvl3_sys_list)" not =>
reglist("@(runlvl3_policy)","$(runlvl3_sys_list)");
commands:
# Disable and terminate anything that isn't in the above list.
"/sbin/chkconfig $(runlvl3_sys_list) off"
ifvarclass => canonify("kill_$(runlvl3_sys_list)");
"/sbin/service $(runlvl3_sys_list) stop"
ifvarclass => canonify("kill_$(runlvl3_sys_list)");
}
> Hello guys,
>
> The following bundle cause iteration problems. Could anybody advise
> how to rewrite it to omit them?
>
> ########################################################
>
> bundle agent system_startup(service)
> {
> vars:
> centos::
> "status" string => execresult("/sbin/chkconfig --list
> $(service)", "noshell");
>
> classes:
> centos::
> "on" expression => regcmp(".*3:on.*","$(status)");
>
> commands:
> !on.centos::
> "/sbin/chkconfig $(service) on",
> comment => "Make sure the service will be spawned upon
> the system startup";
>
> reports:
> !on.centos::
> "$(service) added to the system startup";
> }
>
>
> ########################################################
>
>
> --
> SY, Seva Gluschenko.
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine