From a6eb87bd68295e15ea19f5cb274cffbef5954d04 Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Wed, 8 Jun 2016 18:25:55 +0200 Subject: server-del: perform full master removal in managed topology This patch implements most of the del_master_managed() functionality as a part of `server-del` command. `server-del` nows performs these actions: * check topology connectivity * check that at least one CA/DNS server and DNSSec masters are left after removal * cleanup all LDAP entries/attributes exposing information about the master * cleanup master DNS records * remove master and service principals * remove master entry from LDAP * check that all segments pointing to the master were removed `server-del` now accepts the following options: * `--force`: force master removal even if it doesn't exist * `--ignore-topology-disconnect`: ignore errors arising from disconnected topology before and after master removal * `--ignore-last-of-role`: remove master even if it is last DNS server, and DNSSec key master. The last CA will *not* be removed regardless of this option. https://fedorahosted.org/freeipa/ticket/5588 Reviewed-By: Martin Basti --- ipalib/errors.py | 18 ++++++++++++++++++ ipalib/messages.py | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'ipalib') diff --git a/ipalib/errors.py b/ipalib/errors.py index 406a940e5..71c12f9d3 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -1379,6 +1379,24 @@ class InvalidDomainLevelError(ExecutionError): errno = 4032 format = _('%(reason)s') + +class ServerRemovalError(ExecutionError): + """ + **4033** Raised when a removal of IPA server from managed topology fails + + For example: + + >>> raise ServerRemovalError(reason='Removal disconnects topology') + Traceback (most recent call last): + ... + ServerRemovalError: Server removal aborted: Removal disconnects topology + + """ + + errno = 4033 + format = _('Server removal aborted: %(reason)s.') + + class BuiltinError(ExecutionError): """ **4100** Base class for builtin execution errors (*4100 - 4199*). diff --git a/ipalib/messages.py b/ipalib/messages.py index 910a93e33..d8cee9e83 100644 --- a/ipalib/messages.py +++ b/ipalib/messages.py @@ -364,7 +364,6 @@ class ResultFormattingError(PublicMessage): **13019** Unable to correctly format some part of the result """ errno = 13019 - type = "warning" class FailedToRemoveHostDNSRecords(PublicMessage): @@ -446,6 +445,22 @@ class LocationWithoutDNSServer(PublicMessage): ) +class ServerRemovalInfo(PublicMessage): + """ + **13027** Informative message printed during removal of IPA server + """ + errno = 13027 + type = "info" + + +class ServerRemovalWarning(PublicMessage): + """ + **13028** Warning raised during removal of IPA server + """ + errno = 13028 + type = "warning" + + def iter_messages(variables, base): """Return a tuple with all subclasses """ -- cgit