def domain_remove(args): thesite = Site.get(args.shortname) if not thesite: logger.error("No site named {0} exists".format(thesite.shortname)) else: try: Domain.delete(args.domain_name, thesite) except Domain.DoesNotExist as e: logger.exception("No such domain") except ShellActionFailed as e: logger.exception("Could not remove {0} from {1} because shell actions failed.".format(args.domain_name, args.shortname))
def domain_add(args): thesite = Site.get(args.shortname) if not thesite: logger.error("No site named {0} exists".format(thesite.shortname)) else: try: Domain.create(args.domain_name, thesite) except Domain.Exists: logger.error("Domain {0} already exists in the DB".format(args.domain_name)) except ShellActionFailed as e: logger.exception("Could not add {0} to {1} because shell actions failed.".format(args.domain_name, args.shortname))