fix delete_old_oci_images.py
Previously, the delete_old_oci_images.py script sometimes caused a traceback when trying to get the date from the JSON response for an OIC image blob. This was because it was trying to read a JSON value that didnt exist in some cases. This change simply skips those images -- might update this in the future to fins a fallback date to use, but for now just skip them. Signed-off-by: Ryan Lerch <rlerch@redhat.com>
This commit is contained in:
parent
ace5bcea9c
commit
2883c54e67
|
@ -140,6 +140,11 @@ def main():
|
|||
|
||||
# Find when a blob was created
|
||||
age = resp.json().get("created")
|
||||
if age is None:
|
||||
result["stdout_lines"].append(
|
||||
"Could not get date for {}:{} -- skipping".format(repo, digest)
|
||||
)
|
||||
continue
|
||||
# Check if the blob is older than "days"
|
||||
if datetime.strptime(age[:10], "%Y-%m-%d") <= datetime.now() - timedelta(days=days):
|
||||
if not check_mode:
|
||||
|
|
Loading…
Reference in New Issue