Don't fail if config-show does not return servers

When uninstalling a cluster and only hidden servers are left,
config-show can return a result set without ipa_master_server entry.

Fixes: https://pagure.io/freeipa/issue/7892
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
This commit is contained in:
Christian Heimes 2019-03-26 20:09:27 +01:00
parent d727321ce3
commit 713c9b0ce8
3 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ def uninstall_check(options):
# skip the checks if the host is the last master
ipa_config = api.Command.config_show()['result']
ipa_masters = ipa_config['ipa_master_server']
ipa_masters = ipa_config.get('ipa_master_server', [])
if len(ipa_masters) <= 1:
return

View File

@ -91,7 +91,7 @@ class pkinit_status(Search):
if server is not None:
servers = [server]
else:
servers = ipa_master_config['ipa_master_server']
servers = ipa_master_config.get('ipa_master_server', [])
pkinit_servers = ipa_master_config.get('pkinit_server_server')
if pkinit_servers is None:

View File

@ -482,7 +482,7 @@ class server_del(LDAPDelete):
ipa_config = self.api.Command.config_show()['result']
ipa_masters = ipa_config['ipa_master_server']
ipa_masters = ipa_config.get('ipa_master_server', [])
# skip these checks if the last master is being removed
if len(ipa_masters) <= 1: