mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Re-open the ldif file to prevent error message
There was an issue with ipa-server-upgrade and it was showing an error while upgrading: DN... does not exists or haven't been updated, caused by not moving pointer to file begining when re-reading. Resolves: https://pagure.io/freeipa/issue/7644 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
f68dca24be
commit
6fa1e6f18e
@ -237,17 +237,22 @@ class IPAUpgrade(service.Service):
|
||||
|
||||
def __disable_schema_compat(self):
|
||||
ldif_outfile = "%s.modified.out" % self.filename
|
||||
|
||||
with open(self.filename, "r") as in_file:
|
||||
parser = GetEntryFromLDIF(in_file, entries_dn=[COMPAT_DN])
|
||||
parser.parse()
|
||||
|
||||
try:
|
||||
compat_entry = parser.get_results()[COMPAT_DN]
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
if not compat_entry.get('nsslapd-pluginEnabled'):
|
||||
return
|
||||
|
||||
with open(ldif_outfile, "w") as out_file:
|
||||
with open(self.filename, "r") as in_file:
|
||||
parser = GetEntryFromLDIF(in_file, entries_dn=[COMPAT_DN])
|
||||
parser.parse()
|
||||
try:
|
||||
compat_entry = parser.get_results()[COMPAT_DN]
|
||||
except KeyError:
|
||||
return
|
||||
parser = installutils.ModifyLDIF(in_file, out_file)
|
||||
if not compat_entry.get('nsslapd-pluginEnabled'):
|
||||
return
|
||||
parser.remove_value(COMPAT_DN, "nsslapd-pluginEnabled")
|
||||
parser.remove_value(COMPAT_DN, "nsslapd-pluginenabled")
|
||||
parser.add_value(COMPAT_DN, "nsslapd-pluginEnabled",
|
||||
|
Loading…
Reference in New Issue
Block a user