Skip to content

Commit 82c0349

Browse files
committed
Move curl options from inside curl manifest to command line
1 parent 24d67f9 commit 82c0349

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/azul/service/manifest_service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,12 @@ def command_lines(cls,
13971397
else ()
13981398
)
13991399
]
1400+
file_options = [
1401+
'--fail-early', # Exit curl with error on the first failure encountered
1402+
'--continue-at -', # Resume partially downloaded files
1403+
'--retry 2', # Retry a file download up to X times on transient error
1404+
'--retry-delay 10', # Sleep for X seconds between retries
1405+
]
14001406
return {
14011407
'cmd.exe': ' '.join([
14021408
'curl.exe',
@@ -1405,6 +1411,7 @@ def command_lines(cls,
14051411
'|',
14061412
'curl.exe',
14071413
*authentication_option,
1414+
*file_options,
14081415
'--config',
14091416
'-'
14101417
]),
@@ -1415,6 +1422,7 @@ def command_lines(cls,
14151422
'|',
14161423
'curl',
14171424
*authentication_option,
1425+
*file_options,
14181426
'--config',
14191427
'-'
14201428
])
@@ -1480,10 +1488,6 @@ def _write(file: JSON, is_related_file: bool = False):
14801488
'--location', # Follow redirects
14811489
'--globoff', # Prevent '#' in file names from being interpreted as output variables
14821490
'--fail', # Upon server error don't save the error message to the file
1483-
'--fail-early', # Exit curl with error on the first failure encountered
1484-
'--continue-at -', # Resume partially downloaded files
1485-
'--retry 2', # Retry a file download up to X times on transient error
1486-
'--retry-delay 10', # Sleep for X seconds between retries
14871491
'--write-out "Downloading to: %{filename_effective}\\n\\n"'
14881492
]
14891493
output.write('\n\n'.join(curl_options))

test/service/test_manifest.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,14 +1195,6 @@ def test_curl_manifest(self):
11951195
'',
11961196
'--fail',
11971197
'',
1198-
'--fail-early',
1199-
'',
1200-
'--continue-at -',
1201-
'',
1202-
'--retry 2',
1203-
'',
1204-
'--retry-delay 10',
1205-
'',
12061198
'--write-out "Downloading to: %{filename_effective}\\n\\n"',
12071199
'',
12081200
]
@@ -1496,10 +1488,13 @@ def test(*, format: ManifestFormat, fetch: bool, url: Optional[furl] = None):
14961488
expected_url = object_url
14971489
expected_url_for_bash = f"'{expected_url}'"
14981490
if format is ManifestFormat.curl:
1499-
options = "--location --fail"
1491+
manifest_options = '--location --fail'
1492+
file_options = '--fail-early --continue-at - --retry 2 --retry-delay 10'
15001493
expected = {
1501-
'cmd.exe': f'curl.exe {options} "{expected_url}" | curl.exe --config -',
1502-
'bash': f'curl {options} {expected_url_for_bash} | curl --config -'
1494+
'cmd.exe': f'curl.exe {manifest_options} "{expected_url}"'
1495+
f' | curl.exe {file_options} --config -',
1496+
'bash': f'curl {manifest_options} {expected_url_for_bash}'
1497+
f' | curl {file_options} --config -'
15031498
}
15041499
else:
15051500
if format is ManifestFormat.terra_bdbag:

0 commit comments

Comments
 (0)