summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2017-01-09 11:53:59 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-24 13:25:47 +0100
commit23239bccc18f2fdc10431134a1c6a777f450704e (patch)
tree4c49148fbfd6bb70ff5115393871b59646d55d4e /ipaserver/install
parent84a9611cb885f04c72cd657c3a3e7bc4aff39d93 (diff)
downloadfreeipa-23239bccc18f2fdc10431134a1c6a777f450704e.tar.gz
freeipa-23239bccc18f2fdc10431134a1c6a777f450704e.tar.xz
freeipa-23239bccc18f2fdc10431134a1c6a777f450704e.zip
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>
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/httpinstance.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index bacd5fc4f..ded055308 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -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"])