summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-11-27 21:30:00 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:10 -0600
commit1f7dc278fc73f710eb41446a56031dcc50bfa0af (patch)
treecd89db9286ca5d1fbd09d7db1772ef967ea395bf
parentaf81dafa28947f364409e347227a2ac1d0b6c53d (diff)
downloadvyos-1x-1f7dc278fc73f710eb41446a56031dcc50bfa0af.tar.gz
vyos-1x-1f7dc278fc73f710eb41446a56031dcc50bfa0af.zip
image-tools: T5751: restore arg raise_error for non-interactive use
(cherry picked from commit 35f69340ef189e27b380074bb687ad58f29e9433)
-rw-r--r--python/vyos/remote.py4
-rwxr-xr-xsrc/op_mode/image_installer.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py
index f86d2ef35..b1efcd10b 100644
--- a/python/vyos/remote.py
+++ b/python/vyos/remote.py
@@ -437,11 +437,13 @@ def urlc(urlstring, *args, **kwargs):
raise ValueError(f'Unsupported URL scheme: "{scheme}"')
def download(local_path, urlstring, progressbar=False, check_space=False,
- source_host='', source_port=0, timeout=10.0):
+ source_host='', source_port=0, timeout=10.0, raise_error=False):
try:
progressbar = progressbar and is_interactive()
urlc(urlstring, progressbar, check_space, source_host, source_port, timeout).download(local_path)
except Exception as err:
+ if raise_error:
+ raise
print_error(f'Unable to download "{urlstring}": {err}')
except KeyboardInterrupt:
print_error('\nDownload aborted by user.')
diff --git a/src/op_mode/image_installer.py b/src/op_mode/image_installer.py
index e327fef67..df5d897b7 100755
--- a/src/op_mode/image_installer.py
+++ b/src/op_mode/image_installer.py
@@ -389,13 +389,14 @@ def image_fetch(image_path: str, no_prompt: bool = False) -> Path:
# check a type of path
if urlparse(image_path).scheme:
# download an image
- download(ISO_DOWNLOAD_PATH, image_path, True, True)
+ download(ISO_DOWNLOAD_PATH, image_path, True, True,
+ raise_error=True)
# download a signature
sign_file = (False, '')
for sign_type in ['minisig', 'asc']:
try:
download(f'{ISO_DOWNLOAD_PATH}.{sign_type}',
- f'{image_path}.{sign_type}')
+ f'{image_path}.{sign_type}', raise_error=True)
sign_file = (True, sign_type)
break
except Exception: