Reputation: 135
MongoDB RPM packages (provided by official repo.mongodb.org repository, as of version 3.4.1) automatically and unconditionally restart server on package upgrade. This behaviour is hardcoded into postun handler:
if test $1 -ge 1
then
/usr/bin/systemctl restart mongod >/dev/null 2>&1 || :
fi
This is an inconvenient and dangerous behaviour, especially when you use configuration management tools to set up your servers. For example, I'd like to run a full Ansible playbook to set up my servers first, and then restart MongoDB manually one by one to have full control of the situation.
Is there any way to alter or disable this? Alternative MongoDB packages, maybe? Or some obscure yum/rpm command option to disable scriptlets?
I'm aware that I can switch to simple .tar.gz installation, but this is the last resort.
Upvotes: 1
Views: 355
Reputation: 37782
If you first download the rpm and install it manually using rpm
; you can use the --nopostun
option:
rpm -Uvh mongodb***rpm --nopostun
from the rpm man page:
--noscripts --nopre --nopost --nopreun --nopostun --nopretrans --noposttrans Don't execute the scriptlet of the same name. The --noscripts option is equivalent to --nopre --nopost --nopreun --nopostun --nopretrans --oposttrans and turns off the execution of the corresponding %pre, %post, %preun, %postun %pretrans, and %posttrans scriptlet(s).
afaik yum
cannot handle the --nopostun
and other flags.
Upvotes: 3