diff options
| author | Daniil Baturin <daniil@vyos.io> | 2024-02-08 16:11:50 +0000 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-08 16:11:50 +0000 | 
| commit | 632c9d9f3d52e2c9571018553b5b45d9a3fe6ffd (patch) | |
| tree | 0034b94a17e45192995749ed73b08054d2187b8d /python | |
| parent | 98c6434e7433e6a0aa1034b39c9130d390bbe591 (diff) | |
| parent | b76e4c808c954dcf498b510aaa9c8d6c91850991 (diff) | |
| download | vyos-1x-632c9d9f3d52e2c9571018553b5b45d9a3fe6ffd.tar.gz vyos-1x-632c9d9f3d52e2c9571018553b5b45d9a3fe6ffd.zip | |
Merge pull request #2507 from erkin/image-tools
op-mode: T4038: Python rewrite of image tools
Diffstat (limited to 'python')
| -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 830770d11..129e65772 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -54,7 +54,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) @@ -445,8 +445,10 @@ def download(local_path, urlstring, progressbar=False, check_space=False,          if raise_error:              raise          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): @@ -455,8 +457,10 @@ def upload(local_path, urlstring, progressbar=False,          urlc(urlstring, progressbar, False, 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):      """ | 
