Hi,
today I run groups/copr-backend.yml playbook and fedmsg/base notified "restart
httpd". Which failed because
httpd is there installed, but not enabled (it is there just as requirement of webalizer).
So I'm thinking about change (after freeze):
diff --git a/roles/base/files/common-scripts/conditional-restart.sh
b/roles/base/files/common-scripts/conditional-restart.sh
index f95ef74..f4ac932 100644
--- a/roles/base/files/common-scripts/conditional-restart.sh
+++ b/roles/base/files/common-scripts/conditional-restart.sh
@@ -10,9 +10,13 @@ rpm -q $PACKAGE
INSTALLED=$?
if [ $INSTALLED -eq 0 ]; then
- echo "Package $PACKAGE installed. Attempting restart of $SERVICE."
- /sbin/service $SERVICE restart
- exit $? # Exit with the /sbin/service status code
+ if chkconfig $PACKAGE; then
+ echo "Package $PACKAGE installed. Attempting restart of $SERVICE."
+ /sbin/service $SERVICE restart
+ exit $? # Exit with the /sbin/service status code
+ else
+ echo "Package $PACKAGE not enabled. Skipping restart of $SERVICE."
+ fi
fi
# If the package wasn't installed, then pretend everything is fine.
This works for httpd from el6 to Fedora21. But I tested it only for httpd.
But this is used for all services.
Please raise your voice if you are aware of some service which we want to restart, but we
do not enable it.
--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Senior Software Engineer, #brno, #devexp, #fedora-buildsys