On 08/07/15 14:35, Jan Cholasta wrote:
Hi,

Dne 8.7.2015 v 12:58 Martin Basti napsal(a):
Patch attached.


Use self.log instead of root_logger. Otherwise ACK.

Honza

Updated patch attached.

--
Martin Basti

From 8b121d8e202d6b99e4cbffa690d9b05aaeb92cec Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 8 Jul 2015 12:19:58 +0200
Subject: [PATCH] Upgrade: Do not show upgrade failed message when IPA is not
 installed

---
 freeipa.spec.in                         | 2 +-
 ipaserver/install/ipa_server_upgrade.py | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 415a875faf2ca1ada0d6a3b90d4f1d93d28eb8d1..7e1ad4615d78bba657f542d442732d2627709108 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -536,7 +536,7 @@ 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 || echo "IPA server upgrade failed: Inspect /var/log/ipaupgrade.log and run command ipa-server-upgrade manually."
+/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
diff --git a/ipaserver/install/ipa_server_upgrade.py b/ipaserver/install/ipa_server_upgrade.py
index d0a839d0a316317622894e5b56896f91a9e29bb8..2ebdf9185f83c66b7ecc1b0155f98790e03186df 100644
--- a/ipaserver/install/ipa_server_upgrade.py
+++ b/ipaserver/install/ipa_server_upgrade.py
@@ -50,4 +50,9 @@ class ServerUpgrade(admintool.AdminTool):
             raise admintool.ScriptError(str(e))
 
     def handle_error(self, exception):
+        if not isinstance(exception, SystemExit):
+            # do not log this message when ipa is not installed
+            self.log.error("IPA server upgrade failed: Inspect "
+                              "/var/log/ipaupgrade.log and run command "
+                              "ipa-server-upgrade manually.")
         return installutils.handle_error(exception, self.log_file_name)
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to