-
Type:
Bug
-
Status: Done
-
Priority:
Medium
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.6.6
-
Component/s: Promise type: services
-
Labels:None
From the mailing list "Bernt Jernberg wrote":https://groups.google.com/forum/#!searchin/help-cfengine/$20standard_services$20and$20restart$20again/help-cfengine/OttjcyiJMv8/iXbvLbEXxoAJ
> On a RHEL 6.6 running Community 3.6.5 I have this in my library:
>
<pre>
bundle agent update_service_m(src,dst,m,svc)
{
files:
"$(dst)"
comment => "Sync $(dst)",
copy_from => local_dcp("$(src)"),
classes => if_repaired("$(dst)_restart");
"$(dst)"
comment => "Correct permissions on $(dst)",
perms => system_owned("$(m)"),
classes => if_repaired("$(dst)_update");
methods:
"Restart $(svc)" usebundle => standard_services("$(svc)","restart"),
ifvarclass => canonify("$(dst)_restart");
reports:
"$(dst) updated"
ifvarclass => canonify("$(dst)_restart");
"Permission on $(dst) corrected"
ifvarclass => canonify("$(dst)_update");
}
</pre>
>
>
> I call it like this to update sshd_config:
>
>
<pre>
bundle agent update_sshd_config
{
vars:
"src" strinng => "$(g.cache_files)/etc.ssh.sshd_config";
"dest" strinng => "/etc/ssh/sshd_config";
"mode" strinng => "0600";
"service" strinng => "sshd";
methods:
"Update file" usebundle => update_service_m("$(src)",
"$(dst)",
"$(mode)",
"$(service)");
}
</pre>
>
> Restart never works if the service is not started. If I in lib/3.6/services.cf:
>
> change the line:
>
<pre>
chkconfig.have_init.((start.!running)|((stop|restart|reload).running)).non_disabling::
</pre>
>
> to
>
<pre>
chkconfig.have_init.(((start|restart).!running)|((stop|restart|reload).running)).non_disabling::
</pre>
>
> it works. This may have been discussed already according to https://dev.cfengine.com/issues/6492
- relates to
-
CFE-2541 Restart semantics between systemv init and systemd should not be different
-
- Done
-