On 07/31/2012 02:23 PM, Martin Kosek wrote:
> This is just s short patch fixing a regression introduced in ticket 2652. I
> would like to get this one to beta 2.
> 
> --
> A change to ipa-ldap-updater (and thus an RPM update %post scriptlet)
> avoiding redundat "IPA is not configured" message in stderr introdocued
> in c20d4c71b87365b3b8d9c53418a79f992e68cd00 was reverted in another
> patch (b5c1ce88a4a3b35adb3b22bc68fb10b49322641a).
> 
> Return the change back to avoid this message during every RPM update
> when IPA is not configured. admintool framework was also fixed to
> avoid print an empty line when an exception without an error message
> is raised.
> 
> https://fedorahosted.org/freeipa/ticket/2892
> 

I just noticed that the error message may not be printed at all in same cases.
Sending a fixed version.

Martin

>From 8964c4318c6a5f2b555ec04f478825694558f718 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 31 Jul 2012 14:11:52 +0200
Subject: [PATCH] Avoid redundant info message during RPM update

A change to ipa-ldap-updater (and thus an RPM update %post scriptlet)
avoiding redundat "IPA is not configured" message in stderr introdocued
in c20d4c71b87365b3b8d9c53418a79f992e68cd00 was reverted in another
patch (b5c1ce88a4a3b35adb3b22bc68fb10b49322641a).

Return the change back to avoid this message during every RPM update
when IPA is not configured. admintool framework was also fixed to
avoid print an empty line when an exception without an error message
is raised.

https://fedorahosted.org/freeipa/ticket/2892
---
 ipapython/admintool.py                |  3 ++-
 ipaserver/install/ipa_ldap_updater.py | 11 ++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ipapython/admintool.py b/ipapython/admintool.py
index 60096e083ef209e943886cbe33189e5cdf063787..1ba8b6bbbe478e4b462510337e157524967e7194 100644
--- a/ipapython/admintool.py
+++ b/ipapython/admintool.py
@@ -212,7 +212,8 @@ class AdminTool(object):
             self.log
         except AttributeError:
             # Logging was not set up yet
-            print >> sys.stderr, '\n', error_message
+            if error_message:
+                print >> sys.stderr, '\n', error_message
         else:
             self.info(''.join(traceback.format_tb(backtrace)))
             self.info('The %s command failed, exception: %s: %s',
diff --git a/ipaserver/install/ipa_ldap_updater.py b/ipaserver/install/ipa_ldap_updater.py
index 0c7d940be9b0d9777b7739dc5b63a0fe79b534b9..794ea28b5518b3d7b02d9aa0f691361adecae67d 100644
--- a/ipaserver/install/ipa_ldap_updater.py
+++ b/ipaserver/install/ipa_ldap_updater.py
@@ -25,6 +25,7 @@
 # save undo files?
 
 import os
+import sys
 
 import krbV
 
@@ -83,10 +84,14 @@ class LDAPUpdater(admintool.AdminTool):
                 raise admintool.ScriptError("%s: file not found" % filename)
 
         if os.getegid() == 0:
-            installutils.check_server_configuration()
+            try:
+                installutils.check_server_configuration()
+            except RuntimeError, e:
+                print unicode(e)
+                sys.exit(1)
         elif not os.path.exists('/etc/ipa/default.conf'):
-            raise admintool.ScriptError(
-                "IPA is not configured on this system.")
+            print "IPA is not configured on this system."
+            sys.exit(1)
 
         if options.password:
             pw = ipautil.template_file(options.password, [])
-- 
1.7.11.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to