mirror of https://github.com/zulip/zulip.git
deactivate_realm: Improve error handling for unknown realm.
This commit is contained in:
parent
c2237c60c0
commit
d9dba5d2c2
|
@ -3,6 +3,8 @@ from __future__ import print_function
|
|||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import sys
|
||||
|
||||
from zerver.lib.actions import do_deactivate_realm
|
||||
from zerver.models import get_realm
|
||||
|
||||
|
@ -14,6 +16,10 @@ class Command(BaseCommand):
|
|||
help='domain of realm to deactivate')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
realm = get_realm(options["domain"])
|
||||
if realm is None:
|
||||
print("Could not find realm %s" % (options["domain"],))
|
||||
sys.exit(1)
|
||||
print("Deactivating", options["domain"])
|
||||
do_deactivate_realm(get_realm(options["domain"]))
|
||||
do_deactivate_realm(realm)
|
||||
print("Done!")
|
||||
|
|
Loading…
Reference in New Issue