ac7d03
From 6d44c0c1455442ffd61ad532635c109b92ca96d1 Mon Sep 17 00:00:00 2001
ac7d03
From: Martin Babinsky <mbabinsk@redhat.com>
ac7d03
Date: Fri, 26 May 2017 12:23:51 +0200
ac7d03
Subject: [PATCH] fix incorrect suffix handling in topology checks
ac7d03
ac7d03
When trying to delete a partially removed master entry lacking
ac7d03
'iparepltopomanagedsuffix' attribute, the code that tries to retrieve
ac7d03
tha value for further computations passes None and causes unhandled
ac7d03
internal errors.
ac7d03
ac7d03
If the attribute is empty or not present, we should return empty list
ac7d03
instead as to not break calling cod attribute, the code that tries to
ac7d03
retrieve tha value for further computations passes None and causes
ac7d03
unhandled internal errors. We should return empty list instead.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6965
ac7d03
ac7d03
Reviewed-By: Felipe Volpone <felipevolpone@gmail.com>
ac7d03
---
ac7d03
 ipaserver/topology.py | 11 +++++++----
ac7d03
 1 file changed, 7 insertions(+), 4 deletions(-)
ac7d03
ac7d03
diff --git a/ipaserver/topology.py b/ipaserver/topology.py
ac7d03
index 385da29a66fb7276c55e9aac5c8c266b897721a7..2b6b0835473097eeec673230fab338bef41b8c49 100644
ac7d03
--- a/ipaserver/topology.py
ac7d03
+++ b/ipaserver/topology.py
ac7d03
@@ -72,12 +72,15 @@ def get_topology_connection_errors(graph):
ac7d03
 
ac7d03
 def map_masters_to_suffixes(masters):
ac7d03
     masters_to_suffix = {}
ac7d03
+    managed_suffix_attr = 'iparepltopomanagedsuffix_topologysuffix'
ac7d03
 
ac7d03
     for master in masters:
ac7d03
-        try:
ac7d03
-            managed_suffixes = master.get(
ac7d03
-                'iparepltopomanagedsuffix_topologysuffix')
ac7d03
-        except KeyError:
ac7d03
+        if managed_suffix_attr not in master:
ac7d03
+            continue
ac7d03
+
ac7d03
+        managed_suffixes = master[managed_suffix_attr]
ac7d03
+
ac7d03
+        if managed_suffixes is None:
ac7d03
             continue
ac7d03
 
ac7d03
         for suffix_name in managed_suffixes:
ac7d03
-- 
ac7d03
2.9.4
ac7d03