mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-28 18:01:23 -06:00
py3: upgradeinstance: decode data before storing them as backup...
...and vice versa backup requires string not bytes, but ldap provide bytes thus data must be decoded and encoded from restore https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
parent
f31d73b79a
commit
7fd36e4d36
@ -134,21 +134,22 @@ class IPAUpgrade(service.Service):
|
|||||||
self.filename)
|
self.filename)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
port = config_entry['nsslapd-port'][0]
|
port = config_entry['nsslapd-port'][0].decode('utf-8')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.backup_state('nsslapd-port', port)
|
self.backup_state('nsslapd-port', port)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
security = config_entry['nsslapd-security'][0]
|
security = config_entry['nsslapd-security'][0].decode('utf-8')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.backup_state('nsslapd-security', security)
|
self.backup_state('nsslapd-security', security)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
global_lock = config_entry['nsslapd-global-backend-lock'][0]
|
global_lock = config_entry[
|
||||||
|
'nsslapd-global-backend-lock'][0].decode('utf-8')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -177,16 +178,17 @@ class IPAUpgrade(service.Service):
|
|||||||
parser = installutils.ModifyLDIF(in_file, out_file)
|
parser = installutils.ModifyLDIF(in_file, out_file)
|
||||||
|
|
||||||
if port is not None:
|
if port is not None:
|
||||||
parser.replace_value("cn=config", "nsslapd-port", [port])
|
parser.replace_value(
|
||||||
|
"cn=config", "nsslapd-port", [port.encode('utf-8')])
|
||||||
if security is not None:
|
if security is not None:
|
||||||
parser.replace_value("cn=config", "nsslapd-security",
|
parser.replace_value("cn=config", "nsslapd-security",
|
||||||
[security])
|
[security.encode('utf-8')])
|
||||||
|
|
||||||
# disable global lock by default
|
# disable global lock by default
|
||||||
parser.remove_value("cn=config", "nsslapd-global-backend-lock")
|
parser.remove_value("cn=config", "nsslapd-global-backend-lock")
|
||||||
if global_lock is not None:
|
if global_lock is not None:
|
||||||
parser.add_value("cn=config", "nsslapd-global-backend-lock",
|
parser.add_value("cn=config", "nsslapd-global-backend-lock",
|
||||||
[global_lock])
|
[global_lock.encode('utf-8')])
|
||||||
|
|
||||||
parser.parse()
|
parser.parse()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user