From d651a9877d0e2f9dd1b057630508b488678bb86e Mon Sep 17 00:00:00 2001 From: Martin Babinsky Date: Jun 05 2017 16:37:37 +0000 Subject: 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 Reviewed-By: Felipe Volpone --- diff --git a/ipaserver/topology.py b/ipaserver/topology.py index 385da29..2b6b083 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: