mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
py3: create_cert_db: write to file in a compatible way
Py3 expect bytes to be writed using os.write. Instead of that using io module is more pythonic. 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:
parent
84a9611cb8
commit
23239bccc1
@ -19,6 +19,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import io
|
||||
import os
|
||||
import os.path
|
||||
import pwd
|
||||
@ -314,9 +315,8 @@ class HTTPInstance(service.Service):
|
||||
|
||||
# Create the password file for this db
|
||||
password = ipautil.ipa_generate_password()
|
||||
f = os.open(pwd_file, os.O_CREAT | os.O_RDWR)
|
||||
os.write(f, password)
|
||||
os.close(f)
|
||||
with io.open(pwd_file, 'w') as f:
|
||||
f.write(password)
|
||||
|
||||
ipautil.run([paths.CERTUTIL, "-d", database, "-f", pwd_file, "-N"])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user