[devops] Updated ssh.upload() to overwrite files

This commit is contained in:
Maxim Kulkin 2012-08-10 18:52:52 +04:00
parent 2a80316b04
commit 79f5e81e22

View File

@ -175,8 +175,9 @@ class SSHClient(object):
for entry in files:
local_path = os.path.join(rootdir, entry)
remote_path = os.path.join(targetdir, entry)
if not self.exists(remote_path):
self._sftp.put(local_path, remote_path)
if self.exists(remote_path):
self._sftp.unlink(remote_path)
self._sftp.put(local_path, remote_path)
def exists(self, path):
try: