From 28587c674d711ceee98bff6a2121d8da305ff9a1 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sun, 29 Mar 2026 22:33:33 +0300 Subject: [PATCH] fix-broken-blobs: use argparse for proper flag handling --dry-run as first arg was being parsed as the BASE directory path. --- modules/docker-registry/fix-broken-blobs.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/docker-registry/fix-broken-blobs.sh b/modules/docker-registry/fix-broken-blobs.sh index 8cdadd1e..84d35bdb 100644 --- a/modules/docker-registry/fix-broken-blobs.sh +++ b/modules/docker-registry/fix-broken-blobs.sh @@ -13,13 +13,19 @@ will re-fetch the missing blobs from the upstream registry. Run after garbage-collect (e.g., 3:15 AM Sunday) or daily. """ +import argparse import os import sys sys.stdout.reconfigure(line_buffering=True) -BASE = sys.argv[1] if len(sys.argv) > 1 else "/opt/registry/data" -DRY_RUN = "--dry-run" in sys.argv +parser = argparse.ArgumentParser(description="Remove orphaned registry layer links") +parser.add_argument("base", nargs="?", default="/opt/registry/data", help="Registry data directory") +parser.add_argument("--dry-run", action="store_true", help="Report but don't delete") +args = parser.parse_args() + +BASE = args.base +DRY_RUN = args.dry_run total_removed = 0 total_checked = 0