ipa/freeipa-3.0.0.pre1-026-print-ipa-ldap-updater-errors-during-rpm-upgrade.patch
2012-08-06 18:17:49 +02:00

79 lines
3.0 KiB
Diff

From c20d4c71b87365b3b8d9c53418a79f992e68cd00 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mkosek@redhat.com>
Date: Wed, 11 Jul 2012 16:22:13 +0200
Subject: [PATCH 26/79] Print ipa-ldap-updater errors during RPM upgrade
ipa-ldap-updater does a lot of essential LDAP changes and if it
fails, user may be surprised after the upgrade why things does not
work.
Modify ipa-ldap-updater to print ERROR logging messages by default
and modify RPM upgrade scriptlet to show these errors to user. Console
error messages are now formated in a more user-friendly way.
Information message stating that IPA is not configured and i.e. there
is nothing to be updated is not printer to stderr so that it does
not pop up for every freeipa-server package update when IPA is not
configured.
https://fedorahosted.org/freeipa/ticket/2892
---
freeipa.spec.in | 2 +-
install/tools/ipa-ldap-updater | 16 ++++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/freeipa.spec.in b/freeipa.spec.in
index deeb3341b9379a2cc82e50ca37889287c4c74813..7106310915c8a4e52a009036f7152a38a4c5f18d 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -465,7 +465,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-ldap-updater --upgrade >/dev/null 2>&1 || :
+/usr/sbin/ipa-ldap-updater --upgrade >/dev/null || :
%preun server
if [ $1 = 0 ]; then
diff --git a/install/tools/ipa-ldap-updater b/install/tools/ipa-ldap-updater
index 197b840b07867269340f56e32989820d8af59ae1..8f5c76645d9ba2b204f3b1051d9dc8b23eacce9d 100755
--- a/install/tools/ipa-ldap-updater
+++ b/install/tools/ipa-ldap-updater
@@ -96,10 +96,15 @@ def main():
run_plugins = True
if os.getegid() == 0:
- installutils.check_server_configuration()
+ try:
+ installutils.check_server_configuration()
+ except RuntimeError, e:
+ print unicode(e)
+ sys.exit(1)
else:
if not os.path.exists('/etc/ipa/default.conf'):
- sys.exit("IPA is not configured on this system.")
+ print "IPA is not configured on this system."
+ sys.exit(1)
if options.upgrade:
sys.exit('Upgrade can only be done as root')
if run_plugins:
@@ -115,10 +120,13 @@ def main():
if dirman_password is None:
sys.exit("\nDirectory Manager password required")
+ console_format = '%(levelname)s: %(message)s'
if options.upgrade:
- standard_logging_setup('/var/log/ipaupgrade.log', verbose=True, debug=options.debug, filemode='a')
+ standard_logging_setup('/var/log/ipaupgrade.log', debug=options.debug,
+ console_format=console_format, filemode='a')
else:
- standard_logging_setup(None, verbose=True, debug=options.debug)
+ standard_logging_setup(None, console_format=console_format,
+ debug=options.debug)
cfg = dict (
in_server=True,
--
1.7.11.2