mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-19 19:49:44 -06:00
cleanup_eventstorage command: be more clear when no event_storage is actually configured
This commit is contained in:
@@ -16,16 +16,30 @@ class Command(BaseCommand):
|
||||
# are practice and theory the same. In practice, they are not.
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('storage_name', type=str, help='The name of the storage to clean up')
|
||||
storage_names = get_settings().EVENT_STORAGES.keys()
|
||||
available_storages = ", ".join(storage_names)
|
||||
|
||||
if storage_names:
|
||||
help_text = f'Name of the storage to clean up (one of: {available_storages})'
|
||||
else:
|
||||
help_text = 'Name of the storage to clean up. You have not configured any event storages, so storage ' \
|
||||
'cleanup is not possible.'
|
||||
|
||||
parser.add_argument('storage_name', type=str, help=help_text)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stopped = False
|
||||
signal.signal(signal.SIGINT, self.handle_sigint)
|
||||
|
||||
storage_names = get_settings().EVENT_STORAGES.keys()
|
||||
available_storages = ",".join(storage_names)
|
||||
available_storages = ", ".join(storage_names)
|
||||
|
||||
if options['storage_name'] not in storage_names:
|
||||
if not storage_names:
|
||||
print("Storage name {options['storage_name']} not found because you have not configured any event "
|
||||
"storage at all so cleanup of event-storage doesn't really make sense.")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"Storage name {options['storage_name']} not found. Available storage names: {available_storages}")
|
||||
sys.exit(1)
|
||||
storage = get_storage(options['storage_name'])
|
||||
|
||||
Reference in New Issue
Block a user