diff options
author | James Cammarata <jimi@sngx.net> | 2014-08-06 15:32:31 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2014-08-06 15:32:31 -0500 |
commit | 9b5619d741f34777dfd3bf2096ab795f76678419 (patch) | |
tree | c4b0db669197bb58442155e6544415de50380127 | |
parent | 92382c41810a4496e7f894696da645fe5151c232 (diff) | |
download | ansible-9b5619d741f34777dfd3bf2096ab795f76678419.tar.gz |
Revert "Atomically move known hosts file into place when edited by paramiko connections"
This reverts commit bd49a835b49050d18b2982e4d0b98dddddee0a5e.
-rw-r--r-- | lib/ansible/runner/connection_plugins/paramiko_ssh.py | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index 9e1052b994..e71d0824b6 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -29,7 +29,6 @@ import pipes import socket import random import logging -import tempfile import traceback import fcntl import re @@ -40,6 +39,7 @@ from ansible.callbacks import vvv from ansible import errors from ansible import utils from ansible import constants as C +from ansible.module_utils.basic import atomic_move AUTHENTICITY_MSG=""" paramiko: The authenticity of host '%s' can't be established. @@ -381,25 +381,7 @@ class Connection(object): self.ssh.load_system_host_keys() self.ssh._host_keys.update(self.ssh._system_host_keys) - - # gather information about the current key file, so - # we can ensure the new file has the correct mode/owner - - key_dir = os.path.dirname(self.keyfile) - key_stat = os.stat(self.keyfile) - - # Save the new keys to a temporary file and move it into place - # rather than rewriting the file. We set delete=False because - # the file will be moved into place rather than cleaned up. - - tmp_keyfile = tempfile.NamedTemporaryFile(dir=key_dir, delete=False) - os.chmod(tmp_keyfile.name, key_stat.st_mode & 07777) - os.chown(tmp_keyfile.name, key_stat.st_uid, key_stat.st_gid) - - self._save_ssh_host_keys(tmp_keyfile.name) - tmp_keyfile.close() - - os.rename(tmp_keyfile.name, self.keyfile) + self._save_ssh_host_keys(self.keyfile) except: |