VirtualMailManager/cli/subcommands.py
branchv0.7.x
changeset 754 8363ea6240a5
parent 751 9d739cd2f527
child 756 139ced0fea1e
equal deleted inserted replaced
753:3f1cecdcdfca 754:8363ea6240a5
   177         user_add(ctx)
   177         user_add(ctx)
   178 
   178 
   179 
   179 
   180 def domain_delete(ctx):
   180 def domain_delete(ctx):
   181     """delete the given domain and all its alias domains"""
   181     """delete the given domain and all its alias domains"""
   182     ctx.hdlr.domain_delete(ctx.args.fqdn.lower(), ctx.args.force)
   182     ctx.hdlr.domain_delete(ctx.args.fqdn.lower(), ctx.args.delete_directory,
       
   183                            ctx.args.force)
   183 
   184 
   184 
   185 
   185 def domain_info(ctx):
   186 def domain_info(ctx):
   186     """display information about the given domain"""
   187     """display information about the given domain"""
   187     fqdn = ctx.args.fqdn.lower()
   188     fqdn = ctx.args.fqdn.lower()
   719     dt.set_defaults(func=domain_transport, scmd='domaintransport')
   720     dt.set_defaults(func=domain_transport, scmd='domaintransport')
   720 
   721 
   721     dd = a('domaindelete', aliases=('dd',),
   722     dd = a('domaindelete', aliases=('dd',),
   722            help=_('delete the given domain and all its alias domains'),
   723            help=_('delete the given domain and all its alias domains'),
   723            epilog=fill(_("This subcommand deletes the domain specified by "
   724            epilog=fill(_("This subcommand deletes the domain specified by "
   724                "fqdn.\n\nIf there are accounts, aliases and/or relocated "
   725                "fqdn.\n\nWhen the --delete-directory option is given, vmm "
   725                "users assigned to the given domain, vmm will abort the "
   726                "will delete the directory of the given domain. This overrides "
   726                "requested operation and show an error message. If you know, "
   727                "the domain.delete_directory setting of vmm.cfg.\n\nIf there "
   727                "what you are doing, you can specify the optional argument "
   728                "are accounts, aliases and/or relocated users assigned to the "
   728                "--force.\n\nIf you really always know what you are doing, "
   729                "given domain, vmm will abort the requested operation and show "
   729                "edit your vmm.cfg and set the option domain.force_deletion "
   730                "an error message. If you know, what you are doing, you can "
   730                "to true.")),
   731                "specify the optional argument --force.\n\nIf you really "
       
   732                "always know what you are doing, edit your vmm.cfg and set the "
       
   733                "option domain.force_deletion to true.")),
   731            formatter_class=RawDescriptionHelpFormatter)
   734            formatter_class=RawDescriptionHelpFormatter)
   732     dd.add_argument('fqdn', help=_('a fully qualified domain name'))
   735     dd.add_argument('fqdn', help=_('a fully qualified domain name'))
       
   736     dd.add_argument('--delete-directory', action='store_true',
       
   737                     help="delete the domain's directory recursively")
   733     dd.add_argument('--force', action='store_true',
   738     dd.add_argument('--force', action='store_true',
   734                     help=_('also delete all accounts, aliases and/or '
   739                     help=_('also delete all accounts, aliases and/or '
   735                            'relocated users'))
   740                            'relocated users'))
   736     dd.set_defaults(func=domain_delete, scmd='domaindelete')
   741     dd.set_defaults(func=domain_delete, scmd='domaindelete')
   737 
   742