Re: [Freeipa-devel] [PATCH 0277] Upgrade: Do not show upgrade failed message during RPM transaction when IPA is not installed

2015-07-08 Thread Jan Cholasta

Dne 8.7.2015 v 14:43 Martin Basti napsal(a):

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.



Pushed to master: 07d314070ae647254eb47708d7543c4d995fd885

--
Jan Cholasta

--
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


Re: [Freeipa-devel] [PATCH 0277] Upgrade: Do not show upgrade failed message during RPM transaction when IPA is not installed

2015-07-08 Thread Martin Basti

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 
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

Re: [Freeipa-devel] [PATCH 0277] Upgrade: Do not show upgrade failed message during RPM transaction when IPA is not installed

2015-07-08 Thread Jan Cholasta

Hi,

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

Patch attached.



Use self.log instead of root_logger. Otherwise ACK.

Honza

--
Jan Cholasta

--
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


[Freeipa-devel] [PATCH 0277] Upgrade: Do not show upgrade failed message during RPM transaction when IPA is not installed

2015-07-08 Thread Martin Basti

Patch attached.

--
Martin Basti

From 5928be7850a773420e1d4e6e001aa225a5bdce17 Mon Sep 17 00:00:00 2001
From: Martin Basti 
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 | 6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 8fee33bd958fd375d3a0eb105611679170b0adba..e09e2f5e27f5905155487e84b5daa404a6c3b95f 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -535,7 +535,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..511b224927b1db0ea5cbc2468ab233f76b081d91 100644
--- a/ipaserver/install/ipa_server_upgrade.py
+++ b/ipaserver/install/ipa_server_upgrade.py
@@ -7,6 +7,7 @@ import os
 from ipalib import api
 from ipaplatform.paths import paths
 from ipapython import admintool
+from ipapython.ipa_log_manager import root_logger
 from ipaserver.install import installutils
 from ipaserver.install import server
 
@@ -50,4 +51,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
+root_logger.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