2016-04-21 17:58:22 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import print_function
|
|
|
|
|
2016-06-04 16:52:18 +02:00
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from argparse import ArgumentParser
|
2016-04-21 17:58:22 +02:00
|
|
|
|
|
|
|
from zerver.lib.actions import do_reactivate_realm
|
2017-08-07 17:34:57 +02:00
|
|
|
from zerver.lib.management import ZulipBaseCommand
|
2016-04-21 17:58:22 +02:00
|
|
|
|
2017-08-07 17:34:57 +02:00
|
|
|
class Command(ZulipBaseCommand):
|
2016-04-21 17:58:22 +02:00
|
|
|
help = """Script to reactivate a deactivated realm."""
|
|
|
|
|
|
|
|
def add_arguments(self, parser):
|
2016-06-04 16:52:18 +02:00
|
|
|
# type: (ArgumentParser) -> None
|
2017-08-07 17:34:57 +02:00
|
|
|
self.add_realm_args(parser, True)
|
2016-04-21 17:58:22 +02:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2016-06-04 16:52:18 +02:00
|
|
|
# type: (*Any, **str) -> None
|
2017-08-07 17:34:57 +02:00
|
|
|
realm = self.get_realm(options)
|
|
|
|
if not realm.deactivated:
|
|
|
|
print("Realm", options["realm_id"], "is already active.")
|
|
|
|
exit(0)
|
|
|
|
print("Reactivating", options["realm_id"])
|
2016-04-21 17:58:22 +02:00
|
|
|
do_reactivate_realm(realm)
|
|
|
|
print("Done!")
|