From 0bd34fa78952b1abefde290f5b3bf7b4a67e73dc Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mar 22 2016 09:28:16 +0000 Subject: SPEC: do not run upgrade when ipa server is not installed Running upgrade when IPA is not installed produces false positive errors https://fedorahosted.org/freeipa/ticket/5704 Reviewed-By: Martin Babinsky --- diff --git a/freeipa.spec.in b/freeipa.spec.in index ea38e1b..542dc28 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -880,15 +880,18 @@ fi %posttrans server -# This must be run in posttrans so that updates from previous -# execution that may no longer be shipped are not applied. -/usr/sbin/ipa-server-upgrade --quiet >/dev/null || : - -# Restart IPA processes. This must be also run in postrans so that plugins -# and software is in consistent state +# don't execute upgrade and restart of IPA when server is not installed python2 -c "import sys; from ipaserver.install import installutils; sys.exit(0 if installutils.is_ipa_configured() else 1);" > /dev/null 2>&1 -# NOTE: systemd specific section + if [ $? -eq 0 ]; then + # This must be run in posttrans so that updates from previous + # execution that may no longer be shipped are not applied. + /usr/sbin/ipa-server-upgrade --quiet >/dev/null || : + + # Restart IPA processes. This must be also run in postrans so that plugins + # and software is in consistent state + # NOTE: systemd specific section + /bin/systemctl is-enabled ipa.service >/dev/null 2>&1 if [ $? -eq 0 ]; then /bin/systemctl restart ipa.service >/dev/null 2>&1 || :