Fail on topology disconnect/last role removal

Disconnecting topology/removing last-role-host during server
uninstallation should raise error rather than just being logged
if the appropriate ignore settings are not present.

https://fedorahosted.org/freeipa/ticket/6168

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Stanislav Laznicka 2016-08-12 11:59:41 +02:00 committed by Martin Babinsky
parent 6e6cbda036
commit fea56fefff

View File

@ -294,7 +294,6 @@ def common_cleanup(func):
def remove_master_from_managed_topology(api_instance, options): def remove_master_from_managed_topology(api_instance, options):
try: try:
# we may force the removal # we may force the removal
# if the master was already deleted we will just get a warning
server_del_options = dict( server_del_options = dict(
force=True, force=True,
ignore_topology_disconnect=options.ignore_topology_disconnect, ignore_topology_disconnect=options.ignore_topology_disconnect,
@ -303,8 +302,10 @@ def remove_master_from_managed_topology(api_instance, options):
replication.run_server_del_as_cli( replication.run_server_del_as_cli(
api_instance, api_instance.env.host, **server_del_options) api_instance, api_instance.env.host, **server_del_options)
except errors.ServerRemovalError as e:
raise ScriptError(str(e))
except Exception as e: except Exception as e:
# if the master was already deleted we will just get a warning
root_logger.warning("Failed to delete master: {}".format(e)) root_logger.warning("Failed to delete master: {}".format(e))