diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2015-11-18 13:12:50 +0100 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2015-12-04 23:09:50 +0100 |
commit | ee853a3d35701d1d799f902f823b8a8cedb90013 (patch) | |
tree | d8e6f36c022f1ca04b54a96e6f1bdc76866a1ff4 /install/tools/ipa-replica-manage | |
parent | 0997f6b9aadfe996a02004b4f3d03411ff5d141c (diff) | |
download | freeipa-ee853a3d35701d1d799f902f823b8a8cedb90013.tar.gz freeipa-ee853a3d35701d1d799f902f823b8a8cedb90013.tar.xz freeipa-ee853a3d35701d1d799f902f823b8a8cedb90013.zip |
check whether replica exists before executing the domain level 1 deletion code
Move this check before the parts that check topology suffix connectivity, wait
for removed segments etc. If the hostname does not exist, it should really be
one of the first errors user encounters during ipa-replica-manage del.
https://fedorahosted.org/freeipa/ticket/5424
Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Diffstat (limited to 'install/tools/ipa-replica-manage')
-rwxr-xr-x | install/tools/ipa-replica-manage | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage index 6d303e6f0..512473125 100755 --- a/install/tools/ipa-replica-manage +++ b/install/tools/ipa-replica-manage @@ -668,6 +668,16 @@ def del_master_managed(realm, hostname, options): print("Can't remove itself: %s" % (options.host)) sys.exit(1) + try: + api.Command.server_show(hostname_u) + except errors.NotFound: + if not options.cleanup: + print("{hostname} is not listed among IPA masters.".format( + hostname=hostname)) + print("Please specify an actual server or add the --cleanup " + "option to force clean up.") + sys.exit(1) + # 1. Connect to the local server try: thisrepl = replication.ReplicationManager(realm, options.host, @@ -702,13 +712,7 @@ def del_master_managed(realm, hostname, options): try: api.Command.server_del(hostname_u) except errors.NotFound: - if not options.cleanup: - print("{hostname} does not exist.".format(hostname=hostname)) - print("Please specify an actual server or add the --cleanup " - "option to force clean up.") - sys.exit(1) - else: - print("Server entry already deleted: %s" % (hostname)) + print("Server entry already deleted: %s" % (hostname)) # 6. Cleanup try: |