mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-08-16 16:04:53 -05:00
py3: service.py: replace mkstemp by NamedTemporaryFile
NamedTemporaryfile can be used in more pythonic way and file can be opened in textual mode that is required with PY3 https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
@@ -208,9 +208,10 @@ class Service(object):
|
||||
args += ["-H", ldap_uri]
|
||||
|
||||
if dm_password:
|
||||
[pw_fd, pw_name] = tempfile.mkstemp()
|
||||
os.write(pw_fd, dm_password)
|
||||
os.close(pw_fd)
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode='w', delete=False) as pw_file:
|
||||
pw_file.write(dm_password)
|
||||
pw_name = pw_file.name
|
||||
auth_parms = ["-x", "-D", "cn=Directory Manager", "-y", pw_name]
|
||||
# Use GSSAPI auth when not using DM password or not being root
|
||||
elif os.getegid() != 0:
|
||||
|
||||
Reference in New Issue
Block a user