Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
scrub_realm: Exit unsuccessfully when asked to scrub an active realm.
Anders Kaseorg5f2e895c5e05
diff --git a/zerver/management/commands/scrub_realm.py b/zerver/management/commands/scrub_realm.pyindex 23ae534e4d4..2e4f9ee118b 100644--- a/zerver/management/commands/scrub_realm.py+++ b/zerver/management/commands/scrub_realm.py@@ -1,6 +1,8 @@from argparse import ArgumentParserfrom typing import Any+from django.core.management.base import CommandError+from zerver.actions.realm_settings import do_scrub_realmfrom zerver.lib.management import ZulipBaseCommand@@ -15,8 +17,9 @@ class Command(ZulipBaseCommand):realm = self.get_realm(options)assert realm is not None # Should be ensured by parserif not realm.deactivated:- print("Realm", options["realm_id"], "is active. Please deactivate the Realm the first.")- return+ raise CommandError(+ f'Realm {options["realm_id"]} is active. Please deactivate the realm the first.'+ )print("Scrubbing", options["realm_id"])do_scrub_realm(realm, acting_user=None)print("Done!")