From 73c3495db2dc1df38407aa7b49fed2f222e85bbe Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 28 Apr 2018 10:36:11 +0200 Subject: [PATCH] Use shutil to copy file Signed-off-by: Christian Heimes Reviewed-By: Alexander Bokovoy Reviewed-By: Christian Heimes --- ipaclient/install/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 2f1a4d679..cdfde085a 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -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.