@@ -34,6 +34,7 @@ class Command(BaseCommand):
3434
3535 def handle (self , * args , ** options ):
3636 manifests_updated_count = 0
37+ self ._broken_manifests = []
3738
3839 manifests_v1 = Manifest .objects .filter (
3940 Q (media_type = MEDIA_TYPE .MANIFEST_V1 ),
@@ -68,6 +69,11 @@ def handle(self, *args, **options):
6869 self .style .SUCCESS ("Successfully updated %d manifests." % manifests_updated_count )
6970 )
7071
72+ if self ._broken_manifests :
73+ self .stdout .write (self .style .WARNING ("Found %d broken manifests. PKs:" % len (self ._broken_manifests )))
74+ for manifest in self ._broken_manifests :
75+ self .stdout .write (self .style .WARNING (" %s" % manifest .pk ))
76+
7177 if settings .CACHE_ENABLED and manifests_updated_count != 0 :
7278 base_paths = ContainerDistribution .objects .values_list ("base_path" , flat = True )
7379 if base_paths :
@@ -91,11 +97,13 @@ def update_manifests(self, manifests_qs):
9197 ]
9298
9399 for manifest in manifests_qs .iterator ():
94- # suppress non-existing/already migrated artifacts and corrupted JSON files
95- with suppress (ObjectDoesNotExist , JSONDecodeError ):
100+ try :
96101 needs_update = self .init_manifest (manifest )
97- if needs_update :
98- manifests_to_update .append (manifest )
102+ except (ObjectDoesNotExist , JSONDecodeError ):
103+ self ._broken_manifests .append (manifest )
104+ continue
105+ if needs_update :
106+ manifests_to_update .append (manifest )
99107
100108 if len (manifests_to_update ) > 1000 :
101109 manifests_qs .model .objects .bulk_update (
0 commit comments