Skip to content

Commit d36f659

Browse files
committed
If data is not in the cache AND at a
different prefix, ensure that it exists via a head request. If it does not give an exception. otherwise, ensure just print out that it exists but is not in a cache
1 parent f167048 commit d36f659

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

contentctl/objects/config.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,20 @@ def map_to_attack_data_cache(
432432
for cache in self.test_data_caches
433433
]
434434
)
435-
print(f"\nAttack Data Missing from all caches:\n{url}{prefixes}")
435+
# Give some extra context about missing attack data files/bad mapping
436+
try:
437+
h = head(str(filename))
438+
h.raise_for_status()
439+
except RequestException:
440+
raise ValueError(
441+
f"Error resolving the attack_data file {filename}. It was missing from all caches and a download from the server failed.\n"
442+
f"{url}{prefixes}\n"
443+
)
444+
445+
print(
446+
f"\nAttack Data Missing from all caches, but present at URL:\n{url}{prefixes}"
447+
)
448+
436449
return filename
437450

438451
@property

0 commit comments

Comments
 (0)