From 57fe5cfcce612f529f628b5341d22c5e2f2f6dc9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 11 Nov 2013 13:00:51 -0500 Subject: [PATCH] Switch 'groups' to list from set. Ordering matters from an inheritance perspective. --- confluent/config/configmanager.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/confluent/config/configmanager.py b/confluent/config/configmanager.py index c31ab140..9a574249 100644 --- a/confluent/config/configmanager.py +++ b/confluent/config/configmanager.py @@ -510,16 +510,16 @@ class ConfigManager(object): for node in self._cfgstore['nodes'].iterkeys(): if node not in nodes and 'groups' in self._cfgstore['nodes'][node]: if group in self._cfgstore['nodes'][node]['groups']: - self._cfgstore['nodes'][node]['groups'].discard(group) + self._cfgstore['nodes'][node]['groups'].remove(group) self._node_removed_from_group(node, group) for node in nodes: if node not in self._cfgstore['nodes']: self._cfgstore['nodes'][node] = {'name': {'value': node}, - 'groups': set([group]) } + 'groups': [group] } elif 'groups' not in self._cfgstore['nodes'][node]: - self._cfgstore['nodes'][node]['groups'] = set([group]) + self._cfgstore['nodes'][node]['groups'] = [group] elif group not in self._cfgstore['nodes'][node]['groups']: - self._cfgstore['nodes'][node]['groups'].add(group) + self._cfgstore['nodes'][node]['groups'].append(group) else: continue # next node, this node already in self._node_added_to_group(node, group) @@ -533,11 +533,10 @@ class ConfigManager(object): cfgobj = self._cfgstore['groups'][group] for attr in attribmap[group].iterkeys(): newdict = {} - if (isinstance(attribmap[group][attr], dict) or - isinstance(attribmap[group][attr], set)): - newdict = attribmap[group][attr] - else: + if (isinstance(attribmap[group][attr], str)): newdict = { 'value': attribmap[group][attr] } + else: + newdict = attribmap[group][attr] if 'value' in newdict and attr.startswith("secret."): newdict['cryptvalue'] = crypt_value(newdict['value']) del newdict['value']