|
|
a6f99c |
From 528a21996734467be193673e4f987e7e3acc3ad9 Mon Sep 17 00:00:00 2001
|
|
|
a6f99c |
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
a6f99c |
Date: Sat, 11 May 2019 11:54:40 +0300
|
|
|
a6f99c |
Subject: [PATCH] upgrade: adtrust - catch empty result when retrieving list of
|
|
|
a6f99c |
trusts
|
|
|
a6f99c |
|
|
|
a6f99c |
Upgrade failure when ipa-server-upgrade is being run on a system with no
|
|
|
a6f99c |
trust established but trust configured
|
|
|
a6f99c |
|
|
|
a6f99c |
Fixes: https://pagure.io/freeipa/issue/7939
|
|
|
a6f99c |
---
|
|
|
a6f99c |
ipaserver/install/plugins/adtrust.py | 16 +++++++++++-----
|
|
|
a6f99c |
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
|
a6f99c |
|
|
|
a6f99c |
diff --git a/ipaserver/install/plugins/adtrust.py b/ipaserver/install/plugins/adtrust.py
|
|
|
a6f99c |
index 6b4e2caa2..cdc3a8b04 100644
|
|
|
a6f99c |
--- a/ipaserver/install/plugins/adtrust.py
|
|
|
a6f99c |
+++ b/ipaserver/install/plugins/adtrust.py
|
|
|
a6f99c |
@@ -609,11 +609,17 @@ class update_tdo_to_new_layout(Updater):
|
|
|
a6f99c |
|
|
|
a6f99c |
trusts_dn = self.api.env.container_adtrusts + self.api.env.basedn
|
|
|
a6f99c |
|
|
|
a6f99c |
- trusts = ldap.get_entries(
|
|
|
a6f99c |
- base_dn=trusts_dn,
|
|
|
a6f99c |
- scope=ldap.SCOPE_ONELEVEL,
|
|
|
a6f99c |
- filter=self.trust_filter,
|
|
|
a6f99c |
- attrs_list=self.trust_attrs)
|
|
|
a6f99c |
+ # We might be in a situation when no trusts exist yet
|
|
|
a6f99c |
+ # In such case there is nothing to upgrade but we have to catch
|
|
|
a6f99c |
+ # an exception or it will abort the whole upgrade process
|
|
|
a6f99c |
+ try:
|
|
|
a6f99c |
+ trusts = ldap.get_entries(
|
|
|
a6f99c |
+ base_dn=trusts_dn,
|
|
|
a6f99c |
+ scope=ldap.SCOPE_ONELEVEL,
|
|
|
a6f99c |
+ filter=self.trust_filter,
|
|
|
a6f99c |
+ attrs_list=self.trust_attrs)
|
|
|
a6f99c |
+ except errors.EmptyResult:
|
|
|
a6f99c |
+ trusts = []
|
|
|
a6f99c |
|
|
|
a6f99c |
# For every trust, retrieve its principals and convert
|
|
|
a6f99c |
for t_entry in trusts:
|
|
|
a6f99c |
--
|
|
|
a6f99c |
2.21.0
|
|
|
a6f99c |
|