delete_old_oci_images: fix formating of the script
Signed-off-by: Clement Verna <cverna@tutanota.com>
This commit is contained in:
parent
6760916870
commit
8093e55cdd
1 changed files with 3 additions and 5 deletions
|
@ -101,8 +101,7 @@ def main():
|
||||||
resp = s.get("{}/v2/_catalog?n=500".format(registry))
|
resp = s.get("{}/v2/_catalog?n=500".format(registry))
|
||||||
if not resp.ok:
|
if not resp.ok:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Failed to get the list of images on the {}".format(registry)",
|
msg="Failed to get the list of images on the {}".format(registry), failed=True
|
||||||
failed=True
|
|
||||||
)
|
)
|
||||||
|
|
||||||
repositories = resp.json().get("repositories")
|
repositories = resp.json().get("repositories")
|
||||||
|
@ -113,12 +112,11 @@ def main():
|
||||||
if not resp.ok:
|
if not resp.ok:
|
||||||
result["stdout_lines"].append("Failed to get the list of tags for {}".format(repo))
|
result["stdout_lines"].append("Failed to get the list of tags for {}".format(repo))
|
||||||
|
|
||||||
|
|
||||||
image = resp.json()
|
image = resp.json()
|
||||||
# Log the repositories that don't have any tags
|
# Log the repositories that don't have any tags
|
||||||
if image["tags"] is None:
|
if image["tags"] is None:
|
||||||
result["stdout_lines"].append("{repo} does not have any tags".format(repo))
|
result["stdout_lines"].append("{repo} does not have any tags".format(repo))
|
||||||
continue
|
continue
|
||||||
# For each tag get the maninfest
|
# For each tag get the maninfest
|
||||||
for tag in image["tags"]:
|
for tag in image["tags"]:
|
||||||
resp = s.get("{}/v2/{}/manifests/{}".format(registry, repo, tag))
|
resp = s.get("{}/v2/{}/manifests/{}".format(registry, repo, tag))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue