On 12/03/15 16:21, Rob Crittenden wrote:
Martin Basti wrote:
The patchset ensure, the upgrade order will respect ordering of entries
in *.update files.

Required for: https://fedorahosted.org/freeipa/ticket/4904

Patch 205 also fixes https://fedorahosted.org/freeipa/ticket/3560

Required patch mbasti-0203

Patches attached.



Just reading the patches, untested.

I think ordered should default to True in the update() method of
ldapupdater to keep in spirit with the design.

Otherwise LGTM that it implements what was designed.

rob


New patch that switch default value for ordered to True attached.

--
Martin Basti

From 653d50779cc0e66ac942d5f72d986156fdeabc2d Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 13 Mar 2015 14:59:26 +0100
Subject: [PATCH] Server Upgrade: order update files by default

https://fedorahosted.org/freeipa/ticket/4904
---
 ipaserver/install/dsinstance.py       | 2 +-
 ipaserver/install/ipa_ldap_updater.py | 2 +-
 ipaserver/install/ldapupdate.py       | 2 +-
 ipaserver/install/upgradeinstance.py  | 3 +--
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 6bf31da99f36aaa76bc5cd6b2c80f92f51f86698..52382873527502b28943f32b2e14990dee69f424 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -509,7 +509,7 @@ class DsInstance(service.Service):
     def apply_updates(self):
         ld = ldapupdate.LDAPUpdate(dm_password=self.dm_password, sub_dict=self.sub_dict, plugins=True)
         files = ld.get_all_files(ldapupdate.UPDATES_DIR)
-        ld.update(files, ordered=True)
+        ld.update(files)
 
     def __add_referint_module(self):
         self._ldap_mod("referint-conf.ldif")
diff --git a/ipaserver/install/ipa_ldap_updater.py b/ipaserver/install/ipa_ldap_updater.py
index 4ad7b972795e3aaacd1f5b43a2ad1e26b34a1367..5df7cdf4275b75cc63045e29b92902698dc011a9 100644
--- a/ipaserver/install/ipa_ldap_updater.py
+++ b/ipaserver/install/ipa_ldap_updater.py
@@ -208,7 +208,7 @@ class LDAPUpdater_NonUpgrade(LDAPUpdater):
         if not self.files:
             self.files = ld.get_all_files(UPDATES_DIR)
 
-        modified = ld.update(self.files, ordered=True) or modified
+        modified = ld.update(self.files) or modified
 
         if modified and options.test:
             self.log.info('Update complete, changes to be made, test mode')
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 3e4fc3f7a1de52f7019e674bb04000a082e53ea7..3e59a91153e01223a114365568c4a97b7f66efba 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -745,7 +745,7 @@ class LDAPUpdate:
         for update in all_updates:
             self._delete_record(update)
 
-    def update(self, files, ordered=False):
+    def update(self, files, ordered=True):
         """Execute the update. files is a list of the update files to use.
         :param ordered: Update files are executed in alphabetical order
 
diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py
index 95306fc3c1c13d9b37438d5caf75da43bde06361..018db87a33c5f29aa65836de3f649141fc163acd 100644
--- a/ipaserver/install/upgradeinstance.py
+++ b/ipaserver/install/upgradeinstance.py
@@ -131,8 +131,7 @@ class IPAUpgrade(service.Service):
             ld = ldapupdate.LDAPUpdate(dm_password='', ldapi=True, live_run=self.live_run, plugins=True)
             if len(self.files) == 0:
                 self.files = ld.get_all_files(ldapupdate.UPDATES_DIR)
-            self.modified = (ld.update(self.files, ordered=True) or
-                             self.modified)
+            self.modified = (ld.update(self.files) or self.modified)
         except ldapupdate.BadSyntax, e:
             root_logger.error('Bad syntax in upgrade %s' % str(e))
             self.modified = False
-- 
2.1.0

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