pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0179-fix-incorrect-suffix-handling-in-topology-checks.patch

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