diff --git a/dev/scripts.community/cleanup_namespaces.py b/dev/scripts.community/cleanup_namespaces.py index bbd57b7515..d3b8301398 100644 --- a/dev/scripts.community/cleanup_namespaces.py +++ b/dev/scripts.community/cleanup_namespaces.py @@ -27,6 +27,10 @@ def strip_number_from_string(input_string): def do_cleanup(): + + resp = input("Are you sure you want to run this? ") + print(resp) + # make a list of all namespace names ns_names = [] for ns_name in Namespace.objects.values_list('name', flat=True): @@ -66,13 +70,15 @@ def do_cleanup(): owners = None legacy_count = None - counter += 1 + # is there a matching user for this namespace ...? + found_user = User.objects.filter(username=ns_key).first() + if not found_user: + continue + counter += 1 print('-' * 100) print(f'{counter}. {ns_key}') - # is there a matching user for this namespace ...? - found_user = User.objects.filter(username=ns_key).first() print('') print(f'\tuser: {found_user}')