From 1f7dc278fc73f710eb41446a56031dcc50bfa0af Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 27 Nov 2023 21:30:00 -0600 Subject: image-tools: T5751: restore arg raise_error for non-interactive use (cherry picked from commit 35f69340ef189e27b380074bb687ad58f29e9433) --- python/vyos/remote.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python/vyos') 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.') -- cgit v1.2.3