summaryrefslogtreecommitdiffstats
path: root/pykolab/cli
diff options
context:
space:
mode:
authorTimotheus Pokorra <tp@tbits.net>2015-06-12 12:15:07 +0200
committerTimotheus Pokorra <tp@tbits.net>2015-06-12 12:15:07 +0200
commit94d58ba529201de81f956fa8e868a9438bdd18c8 (patch)
tree48f0d9921940e99e85027d638387b1bbbed47d2e /pykolab/cli
parentac1ab08b8611b7f5b8b6e0f0834f801f75e73918 (diff)
downloadpykolab-94d58ba529201de81f956fa8e868a9438bdd18c8.tar.gz
cli: kolab delete-domain improved. (#5098)
it now displays if the command succeeded, or shows the error message from the Kolab API. new parameter --force to delete a domain even if user accounts exist.
Diffstat (limited to 'pykolab/cli')
-rw-r--r--pykolab/cli/cmd_delete_domain.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pykolab/cli/cmd_delete_domain.py b/pykolab/cli/cmd_delete_domain.py
index 78580d0..5204923 100644
--- a/pykolab/cli/cmd_delete_domain.py
+++ b/pykolab/cli/cmd_delete_domain.py
@@ -35,6 +35,17 @@ def __init__():
def description():
return _("Delete a domain.")
+def cli_options():
+ my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
+
+ my_option_group.add_option(
+ '--force',
+ dest = "force",
+ action = "store_true",
+ default = False,
+ help = _("Force deleting the domain even if it contains user accounts")
+ )
+
def execute(*args, **kw):
from pykolab import wap_client
@@ -55,4 +66,9 @@ def execute(*args, **kw):
except IndexError, errmsg:
domain = utils.ask_question(_("Domain name"))
- wap_client.domain_delete(domain)
+ if wap_client.domain_delete(domain, conf.force):
+ print("Domain %s has been marked as deleted." % domain)
+ print("Please run this command to actually delete the domain: ")
+ print(" php /usr/share/kolab-webadmin/bin/domain_delete.php")
+ else:
+ print("Domain %s has not been deleted." % domain)