|
|
95ea96 |
From fd54380d684494e13d8e797b17412a6713937b95 Mon Sep 17 00:00:00 2001
|
|
|
95ea96 |
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
|
|
|
95ea96 |
Date: Thu, 2 Aug 2018 18:05:51 +0200
|
|
|
95ea96 |
Subject: [PATCH] Re-open the ldif file to prevent error message
|
|
|
95ea96 |
|
|
|
95ea96 |
There was an issue with ipa-server-upgrade and it was
|
|
|
95ea96 |
showing an error while upgrading:
|
|
|
95ea96 |
DN... does not exists or haven't been updated, caused
|
|
|
95ea96 |
by not moving pointer to file begining when re-reading.
|
|
|
95ea96 |
|
|
|
95ea96 |
Resolves: https://pagure.io/freeipa/issue/7644
|
|
|
95ea96 |
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
|
|
|
95ea96 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
95ea96 |
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
|
|
|
95ea96 |
---
|
|
|
95ea96 |
ipaserver/install/upgradeinstance.py | 21 +++++++++++++--------
|
|
|
95ea96 |
1 file changed, 13 insertions(+), 8 deletions(-)
|
|
|
95ea96 |
|
|
|
95ea96 |
diff --git a/ipaserver/install/upgradeinstance.py b/ipaserver/install/upgradeinstance.py
|
|
|
95ea96 |
index 19a06a0a84536cb548822e47038142e97d8bee39..cb83d7bb1817d1fd9a36f2e97a5cc80bf806cabd 100644
|
|
|
95ea96 |
--- a/ipaserver/install/upgradeinstance.py
|
|
|
95ea96 |
+++ b/ipaserver/install/upgradeinstance.py
|
|
|
95ea96 |
@@ -237,17 +237,22 @@ class IPAUpgrade(service.Service):
|
|
|
95ea96 |
|
|
|
95ea96 |
def __disable_schema_compat(self):
|
|
|
95ea96 |
ldif_outfile = "%s.modified.out" % self.filename
|
|
|
95ea96 |
+
|
|
|
95ea96 |
+ with open(self.filename, "r") as in_file:
|
|
|
95ea96 |
+ parser = GetEntryFromLDIF(in_file, entries_dn=[COMPAT_DN])
|
|
|
95ea96 |
+ parser.parse()
|
|
|
95ea96 |
+
|
|
|
95ea96 |
+ try:
|
|
|
95ea96 |
+ compat_entry = parser.get_results()[COMPAT_DN]
|
|
|
95ea96 |
+ except KeyError:
|
|
|
95ea96 |
+ return
|
|
|
95ea96 |
+
|
|
|
95ea96 |
+ if not compat_entry.get('nsslapd-pluginEnabled'):
|
|
|
95ea96 |
+ return
|
|
|
95ea96 |
+
|
|
|
95ea96 |
with open(ldif_outfile, "w") as out_file:
|
|
|
95ea96 |
with open(self.filename, "r") as in_file:
|
|
|
95ea96 |
- parser = GetEntryFromLDIF(in_file, entries_dn=[COMPAT_DN])
|
|
|
95ea96 |
- parser.parse()
|
|
|
95ea96 |
- try:
|
|
|
95ea96 |
- compat_entry = parser.get_results()[COMPAT_DN]
|
|
|
95ea96 |
- except KeyError:
|
|
|
95ea96 |
- return
|
|
|
95ea96 |
parser = installutils.ModifyLDIF(in_file, out_file)
|
|
|
95ea96 |
- if not compat_entry.get('nsslapd-pluginEnabled'):
|
|
|
95ea96 |
- return
|
|
|
95ea96 |
parser.remove_value(COMPAT_DN, "nsslapd-pluginEnabled")
|
|
|
95ea96 |
parser.remove_value(COMPAT_DN, "nsslapd-pluginenabled")
|
|
|
95ea96 |
parser.add_value(COMPAT_DN, "nsslapd-pluginEnabled",
|
|
|
95ea96 |
--
|
|
|
95ea96 |
2.17.1
|
|
|
95ea96 |
|