Hi there
I'd appreciate your opinions on the following, as I'm sure this will
have an impact on many of us pretty soon.
My Christmastime readings about systemd and a recent message to this
list from Bryan Burke (see below) seem to suggest that CFEngine
practitioners will have to develop a best practice pretty quick
regarding service management. And not only us: all of the people
managing services using Puppet, Chef, Salt or whatever may be impacted.
One of the features of systemd is that forked processes can't escape
their parent in no way. The moment you kill the parent, you kill the
children, too, and there is no way out of this.
Bryan attempt to have CFEngine upgrade itself on a systemd-bound OS seem
to suggest exactly that: the new package installs, the post-installation
scripts request a service restart and boom! The whole thing is killed,
leaving the upgrade half-way done.
This suggests a few things to me.
The more important one is: on systemd-bound OSs we should get into the
habit of asking systemd to start/stop services and let go the (now) bad
habit of restarting a service by running it's script from init.d
directly. If not, that process may result as a child of CFEngine, and
should CFEngine stop for any reason, part of the system will go down
with it.
The second one is: on such systems we should maybe delegate the upgrade
of CFEngine to atd (like launching "at now+1min
/usr/local/sbin/upgrade-cfengine" for example) or to anything that
doesn't kill the process that upgrades CFEngine
Finally: all this should kept in mind when writing the pre/post
installation scripts in the CFEngine packages for systemd-bound OSs.
I look forward to your considerations
Ciao
-- bronto
-------- Forwarded Message --------
Subject: Re: [help-cfengine] CFEngine update
Date: Sat, 17 Jan 2015 01:09:07 -0500
From: Bryan Burke <
bbur...@gmail.com>
To: help-cfengine <
help-c...@googlegroups.com>
>
> I find doing the update via cfengine is a kinda tricky. If something
> goes wrong your node could be left stranded. We have adopted a stance
> that upgrades to CFEngine should be handled by an external tool due to
> the snake eating it's tail scenario.
Indeed, to give some specifics, I’d like to update cfengine via
cfengine, but I’ve recently run into the problem where cfengine trying
to update itself present problems.
I *think* what is happening in my case is that, when cfengine
successfully updates it’s RPM (these are RHEL7 systems), part of the
postinstall/update script attempts to issue the command “service
cfengine3 restart”, which gets redirected to “systemctl restart
cfengine3”. However, because of cgroup-type management of processes and
their children, this ends up sending a SIGTERM to the running cf-agent,
the yum command, or both. Whatever the exact actions are, I get left in
a state where both the old and new versions of cfengine-community are
installed. Running ‘yum-complete-transaction’ finishes/fixed the
process, but obviously this is not ideal.
If there is interest in trying to handle this, I could open a redmine
ticket on the issue.
—
Bryan