minimum_connections was sometimes not updated properly on install because the script set psearch on but assumed it was still off.
Also, the number of connections was not set if the directive was missing.

Fix of the patch for https://fedorahosted.org/freeipa/ticket/2554

--
PetrĀ³

From 599eae67817d106a9541f72e7a0d77fdad013e15 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Wed, 18 Jul 2012 06:47:07 -0400
Subject: [PATCH] Fix updating minimum_connections in ipa-upgradeconfig

The upgrade script set the "psearch" directive in some circumstances,
but did not remember that it was set, so later, when setting
minimum_connections, it assumed psearch is not set.

Also, the script did not set minimum_connections if the directive wasn't
already there. It should be set in that case.
---
 install/tools/ipa-upgradeconfig |   35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/install/tools/ipa-upgradeconfig b/install/tools/ipa-upgradeconfig
index b82f039d4ce8db05ce41193212951d4d79fca79b..68666d04c886b9c962f5e924520115de124e878a 100644
--- a/install/tools/ipa-upgradeconfig
+++ b/install/tools/ipa-upgradeconfig
@@ -339,6 +339,7 @@ def named_enable_psearch():
                         bindinstance.NAMED_CONF, e)
             else:
                 changed = True
+                psearch = "yes"
         sysupgrade.set_upgrade_state('named.conf', 'psearch_enabled', True)
         root_logger.debug('Persistent search enabled')
 
@@ -353,24 +354,24 @@ def named_enable_psearch():
         root_logger.debug('Cannot retrieve connections option from %s: %s',
                 bindinstance.NAMED_CONF, e)
         return
-    if connections is not None:
-        try:
+    try:
+        if connections is not None:
             connections = int(connections)
-        except ValueError:
-            # this should not happend, but there is some bad value in
-            # "connections" option, bail out
-            pass
-        else:
-            if connections < minimum_connections:
-                try:
-                    bindinstance.named_conf_set_directive('connections',
-                                                          minimum_connections)
-                    root_logger.debug('Connections set to %d', minimum_connections)
-                except IOError, e:
-                    root_logger.error('Cannot update connections in %s: %s',
-                            bindinstance.NAMED_CONF, e)
-                else:
-                    changed = True
+    except ValueError:
+        # this should not happend, but there is some bad value in
+        # "connections" option, bail out
+        pass
+    else:
+        if connections is None or connections < minimum_connections:
+            try:
+                bindinstance.named_conf_set_directive('connections',
+                                                        minimum_connections)
+                root_logger.debug('Connections set to %d', minimum_connections)
+            except IOError, e:
+                root_logger.error('Cannot update connections in %s: %s',
+                        bindinstance.NAMED_CONF, e)
+            else:
+                changed = True
 
     if not changed:
         root_logger.debug('No changes made')
-- 
1.7.10.4

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

Reply via email to