py3: create DNS zonefile: use textual mode

Also code was rewritten to use NamedTemporaryFile with context

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti
2017-02-10 14:03:04 +01:00
committed by Jan Cholasta
parent 47f912e16b
commit 488d01ced7
+7 -4
View File
@@ -670,10 +670,13 @@ class BindInstance(service.Service):
system_records.get_base_records()
)
)
[fd, name] = tempfile.mkstemp(".db","ipa.system.records.")
os.write(fd, text)
os.close(fd)
print("Please add records in this file to your DNS system:", name)
with tempfile.NamedTemporaryFile(
mode="w", prefix="ipa.system.records.",
suffix=".db", delete=False
) as f:
f.write(text)
print("Please add records in this file to your DNS system:",
f.name)
def create_instance(self):