summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/remote.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py
index d4efac0d9..417f9d42c 100644
--- a/python/vyos/remote.py
+++ b/python/vyos/remote.py
@@ -220,23 +220,21 @@ class SshC:
def upload(self, location: str):
with self._establish() as ssh, ssh.open_sftp() as sftp:
+ # A file exists at this destination. We're simply going to clobber it.
+ # This is our default fallback
+ path = self.path
try:
# If the remote path is a directory, use the original filename.
if stat.S_ISDIR(sftp.stat(self.path).st_mode):
path = os.path.join(self.path, os.path.basename(location))
- # A file exists at this destination. We're simply going to clobber it.
- else:
- path = self.path
- # This path doesn't point at any existing file. We can freely use this filename.
except IOError:
- path = self.path
- finally:
- if self.progressbar:
- with Progressbar() as p:
- sftp.put(location, path, callback=p.progress)
- else:
- sftp.put(location, path)
+ pass
+ if self.progressbar:
+ with Progressbar() as p:
+ sftp.put(location, path, callback=p.progress)
+ else:
+ sftp.put(location, path)
class HttpC:
def __init__(self,