Skip to content

Commit cb82307

Browse files
mcgovCopilot
andcommitted
Wget: add skip_exists option and align the Windows signature
Downloading large assets again on every run is slow and can fail on flaky mirrors. Add skip_exists so callers can reuse a file that is already present on the node instead of removing and redownloading it. WindowsWget.get takes the same argument so the override keeps matching the base class. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5d5f58ad-b9df-4420-ad37-22caee78e925
1 parent 3a97a97 commit cb82307

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lisa/base_tools/wget.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def get(
4848
sudo: bool = False,
4949
force_run: bool = False,
5050
timeout: int = 600,
51+
skip_exists: bool = False,
5152
) -> str:
5253
cached_filename = self._url_file_cache.get(url, None)
5354
if cached_filename:
@@ -66,8 +67,12 @@ def get(
6667

6768
# remove existing file and dir to download again.
6869
download_pure_path = self.node.get_pure_path(download_path)
69-
if overwrite and self.node.shell.exists(download_pure_path):
70-
self.node.shell.remove(download_pure_path, recursive=True)
70+
if self.node.shell.exists(download_pure_path):
71+
if skip_exists:
72+
return download_path
73+
elif overwrite:
74+
self.node.shell.remove(download_pure_path, recursive=True)
75+
7176
command = f"'{url}' --no-check-certificate"
7277
if filename:
7378
command = f"{command} -O {download_path}"
@@ -171,6 +176,7 @@ def get(
171176
sudo: bool = False,
172177
force_run: bool = False,
173178
timeout: int = 600,
179+
skip_exists: bool = False,
174180
) -> str:
175181
cached_filename = self._url_file_cache.get(url, None)
176182
if cached_filename:

0 commit comments

Comments
 (0)