diff options
author | erkin <me@erkin.party> | 2023-11-20 08:01:59 +0300 |
---|---|---|
committer | erkin <me@erkin.party> | 2024-01-25 17:38:55 +0300 |
commit | b76e4c808c954dcf498b510aaa9c8d6c91850991 (patch) | |
tree | 00ce70d54f94ec03e42c34458404c8bc7220b658 /python/vyos/remote.py | |
parent | 59b432b97e361f3f5670302f51881ee596afe2f8 (diff) | |
download | vyos-1x-b76e4c808c954dcf498b510aaa9c8d6c91850991.tar.gz vyos-1x-b76e4c808c954dcf498b510aaa9c8d6c91850991.zip |
op-mode: T4038: Python rewrite of image tools
Diffstat (limited to 'python/vyos/remote.py')
-rw-r--r-- | python/vyos/remote.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py index 4be477d24..b7c9ed176 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -50,7 +50,7 @@ class InteractivePolicy(MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): print_error(f"Host '{hostname}' not found in known hosts.") print_error('Fingerprint: ' + key.get_fingerprint().hex()) - if is_interactive() and ask_yes_no('Do you wish to continue?'): + if sys.stdin.isatty() and ask_yes_no('Do you wish to continue?'): if client._host_keys_filename\ and ask_yes_no('Do you wish to permanently add this host/key pair to known hosts?'): client._host_keys.add(hostname, key.get_name(), key) @@ -330,8 +330,10 @@ def download(local_path, urlstring, progressbar=False, check_space=False, urlc(urlstring, progressbar, check_space, source_host, source_port, timeout).download(local_path) except Exception as err: print_error(f'Unable to download "{urlstring}": {err}') + sys.exit(1) except KeyboardInterrupt: print_error('\nDownload aborted by user.') + sys.exit(1) def upload(local_path, urlstring, progressbar=False, source_host='', source_port=0, timeout=10.0): @@ -340,8 +342,10 @@ def upload(local_path, urlstring, progressbar=False, urlc(urlstring, progressbar, source_host, source_port, timeout).upload(local_path) except Exception as err: print_error(f'Unable to upload "{urlstring}": {err}') + sys.exit(1) except KeyboardInterrupt: print_error('\nUpload aborted by user.') + sys.exit(1) def get_remote_config(urlstring, source_host='', source_port=0): """ |