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

PR body:
"""
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
"""

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 7543b48870f1046067fd8adf4106bb72c6b688dc 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 | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/ipaserver/topology.py b/ipaserver/topology.py
index 385da29a66..7da68552f5 100644
--- a/ipaserver/topology.py
+++ b/ipaserver/topology.py
@@ -74,11 +74,8 @@ def map_masters_to_suffixes(masters):
     masters_to_suffix = {}
 
     for master in masters:
-        try:
-            managed_suffixes = master.get(
-                'iparepltopomanagedsuffix_topologysuffix')
-        except KeyError:
-            continue
+        managed_suffixes = master.get(
+            'iparepltopomanagedsuffix_topologysuffix', [])
 
         for suffix_name in managed_suffixes:
             try:
_______________________________________________
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