diff options
-rw-r--r-- | src/lib/Server/Plugins/SSHbase.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index 4e26001c1..e5cabfbd5 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -4,6 +4,7 @@ __revision__ = '$Revision$' import binascii import os import socket +import shutil import tempfile from subprocess import Popen, PIPE import Bcfg2.Server.Plugin @@ -252,8 +253,8 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, temploc = "%s/%s" % (tempdir, hostkey) cmd = 'ssh-keygen -q -f %s -N "" -t %s -C root@%s < /dev/null' os.system(cmd % (temploc, keytype, client)) - open(fileloc, 'w').write(open(temploc).read()) - open(publoc, 'w').write(open("%s.pub" % temploc).read()) + shutil.copy(temploc, fileloc) + shutil.copy("%s.pub" % temploc, publoc) self.AddEntry(hostkey) self.AddEntry(".".join([hostkey.split('.')[0]]+['pub', "H_%s" \ % client])) |