Use shutil to copy file

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Christian Heimes committed 2018-04-28 16:35:16 +02:00
1 parent 792adebfab
commit 73c3495db2
1 file changed
+4 -3
+4 -3
View File
@@ -21,6 +21,7 @@ import gssapi
import netifaces
import os
import SSSDConfig
import shutil
import socket
import sys
import tempfile
@@ -641,9 +642,9 @@ def configure_krb5_conf(
# templating, but that could be changed in the future.
template = os.path.join(
paths.USR_SHARE_IPA_DIR,
os.path.basename(paths.KRB5_FREEIPA) + ".template")
contents = open(template).read()
open(paths.KRB5_FREEIPA, "w+").write(contents)
os.path.basename(paths.KRB5_FREEIPA) + ".template"
)
shutil.copy(template, paths.KRB5_FREEIPA)
os.chmod(paths.KRB5_FREEIPA, 0x644)
# Then, perform the rest of our configuration into krb5.conf itself.