mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
adtrustinstance: write the conf as a string
Since ipautil.template_file() returns a string, we should not try to write it as bytes. https://pagure.io/freeipa/issue/4985 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
a83b2583ab
commit
8311069d18
@ -509,23 +509,17 @@ class ADTRUSTInstance(service.Service):
|
||||
self.print_msg(UPGRADE_ERROR % dict(dn=targets_dn))
|
||||
|
||||
def __write_smb_registry(self):
|
||||
template = os.path.join(paths.USR_SHARE_IPA_DIR, "smb.conf.template")
|
||||
conf = ipautil.template_file(template, self.sub_dict)
|
||||
[tmp_fd, tmp_name] = tempfile.mkstemp()
|
||||
os.write(tmp_fd, conf)
|
||||
os.close(tmp_fd)
|
||||
|
||||
# Workaround for: https://fedorahosted.org/freeipa/ticket/5687
|
||||
# We make sure that paths.SMB_CONF file exists, hence touch it
|
||||
with open(paths.SMB_CONF, 'a'):
|
||||
os.utime(paths.SMB_CONF, None)
|
||||
|
||||
args = [paths.NET, "conf", "import", tmp_name]
|
||||
|
||||
try:
|
||||
ipautil.run(args)
|
||||
finally:
|
||||
os.remove(tmp_name)
|
||||
template = os.path.join(paths.USR_SHARE_IPA_DIR, "smb.conf.template")
|
||||
conf = ipautil.template_file(template, self.sub_dict)
|
||||
with tempfile.NamedTemporaryFile(mode='w') as tmp_conf:
|
||||
tmp_conf.write(conf)
|
||||
tmp_conf.flush()
|
||||
ipautil.run([paths.NET, "conf", "import", tmp_conf.name])
|
||||
|
||||
def __setup_group_membership(self):
|
||||
# Add the CIFS and host principals to the 'adtrust agents' group
|
||||
|
Loading…
Reference in New Issue
Block a user