diff options
author | Martin Basti <mbasti@redhat.com> | 2017-01-31 19:59:31 +0100 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2017-02-10 14:03:04 +0100 |
commit | 488d01ced715929d47f6766a63b7d6c597125562 (patch) | |
tree | 2c9b21262060c4eed283a3c5c113f42edcaee35a /ipaserver/install | |
parent | 47f912e16ba6de2f3579de610b0d902cf3e621a2 (diff) | |
download | freeipa-488d01ced715929d47f6766a63b7d6c597125562.tar.gz freeipa-488d01ced715929d47f6766a63b7d6c597125562.tar.xz freeipa-488d01ced715929d47f6766a63b7d6c597125562.zip |
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>
Diffstat (limited to 'ipaserver/install')
-rw-r--r-- | ipaserver/install/bindinstance.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py index b1024aa9c..03dce56aa 100644 --- a/ipaserver/install/bindinstance.py +++ b/ipaserver/install/bindinstance.py @@ -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): |