Skip to content

Commit

Permalink
Checkin.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Oct 3, 2023
1 parent 2f6986f commit d04095d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions dev/community_scripts/cleanup_namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,34 @@ def do_cleanup():
if len(ns_map[ns_key]) <= 1:
continue

print('-' * 100)
print(ns_key)
# is there a user for this namespace ...?
found_user = User.objects.filter(username=ns_key).first()

ns = Namespace.objects.filter(name=ns_key).first()
if ns:
collection_count = CollectionVersion.objects.filter(namespace=dupe_name).count()
owners = rbac.get_v3_namespace_owners(ns)
legacy_count = LegacyNamespace.objects.filter(namespace=ns).count()
else:
collection_count = None
owners = None
legacy_count = None

print('')
print(f'\tnamespace:{ns} legacy-ns:{legacy_count} collections:{collection_count} owners:{owners}')
print('')

for dupe_name in ns_map[ns_key]:
ns = Namespace.objects.filter(name=dupe_name).first()
dupe_ns = Namespace.objects.filter(name=dupe_name).first()
collection_count = CollectionVersion.objects.filter(namespace=dupe_name).count()
dupe_owners = rbac.get_v3_namespace_owners(ns)
print(f'\t{dupe_name} collections:{collection_count} owners:{dupe_owners}')
dupe_owners = rbac.get_v3_namespace_owners(dupe_ns)
dupe_legacy_count = LegacyNamespace.objects.filter(namespace=ns).count()

print(f'\t\t{dupe_name} legacy-ns:{dupe_legacy_count} collections:{collection_count} owners:{dupe_owners}')

#import epdb; epdb.st()
# import epdb; epdb.st()


do_cleanup()

0 comments on commit d04095d

Please sign in to comment.