URL: https://github.com/freeipa/freeipa/pull/821
Author: martbab
 Title: #821: fix incorrect suffix handling in topology checks
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/821/head:pr821
git checkout pr821
From 25bb509404d8111fd761ec3074e558a725c7dadd Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Fri, 26 May 2017 12:23:51 +0200
Subject: [PATCH] fix incorrect suffix handling in topology checks

When trying to delete a partially removed master entry lacking
'iparepltopomanagedsuffix' attribute, the code that tries to retrieve
tha value for further computations passes None and causes unhandled
internal errors.

If the attribute is empty or not present, we should return empty list
instead as to not break calling cod attribute, the code that tries to
retrieve tha value for further computations passes None and causes
unhandled internal errors. We should return empty list instead.

https://pagure.io/freeipa/issue/6965
---
 ipaserver/topology.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ipaserver/topology.py b/ipaserver/topology.py
index 385da29a66..2b6b083547 100644
--- a/ipaserver/topology.py
+++ b/ipaserver/topology.py
@@ -72,12 +72,15 @@ def get_topology_connection_errors(graph):
 
 def map_masters_to_suffixes(masters):
     masters_to_suffix = {}
+    managed_suffix_attr = 'iparepltopomanagedsuffix_topologysuffix'
 
     for master in masters:
-        try:
-            managed_suffixes = master.get(
-                'iparepltopomanagedsuffix_topologysuffix')
-        except KeyError:
+        if managed_suffix_attr not in master:
+            continue
+
+        managed_suffixes = master[managed_suffix_attr]
+
+        if managed_suffixes is None:
             continue
 
         for suffix_name in managed_suffixes:
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to