From 713c9b0ce89ce9835b78c25d3c7b46bb0d71bd83 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 26 Mar 2019 20:09:27 +0100 Subject: [PATCH] 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 Reviewed-By: Francois Cami Reviewed-By: Thomas Woerner --- ipaserver/install/ca.py | 2 +- ipaserver/plugins/pkinit.py | 2 +- ipaserver/plugins/server.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ipaserver/install/ca.py b/ipaserver/install/ca.py index c29759cfe..47730616e 100644 --- a/ipaserver/install/ca.py +++ b/ipaserver/install/ca.py @@ -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 diff --git a/ipaserver/plugins/pkinit.py b/ipaserver/plugins/pkinit.py index 885393846..6d42a9af1 100644 --- a/ipaserver/plugins/pkinit.py +++ b/ipaserver/plugins/pkinit.py @@ -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: diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py index 65188e915..3c0038d0c 100644 --- a/ipaserver/plugins/server.py +++ b/ipaserver/plugins/server.py @@ -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: