From 9f16375b14af2e4ee29f71b354f5c74dda56c7b5 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 12 Mar 2015 15:59:25 -0400 Subject: [PATCH] Make noderange attribute pass through API better On the plugin front, add a one-off description for the 'noderange' attribute. For the other pieces, make noderange more like any 'extensible' string value rather than making it special. --- confluent_server/confluent/config/configmanager.py | 2 -- confluent_server/confluent/noderange.py | 3 ++- confluent_server/confluent/plugins/configuration/attributes.py | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 2ea796e8..fcfb4950 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -819,8 +819,6 @@ class ConfigManager(object): for attr in attribmap[group].iterkeys(): if attr == 'nodes': newdict = set(attribmap[group][attr]) - elif attr == 'noderange': - newdict = attribmap[group][attr] elif (isinstance(attribmap[group][attr], str) or isinstance(attribmap[group][attr], unicode)): newdict = {'value': attribmap[group][attr]} diff --git a/confluent_server/confluent/noderange.py b/confluent_server/confluent/noderange.py index bf2000d9..35110b09 100644 --- a/confluent_server/confluent/noderange.py +++ b/confluent_server/confluent/noderange.py @@ -139,7 +139,8 @@ class NodeRange(object): grpcfg = self.cfm.get_nodegroup_attributes(element) nodes = grpcfg['nodes'] if 'noderange' in grpcfg and grpcfg['noderange']: - nodes |= NodeRange(grpcfg['noderange'], self.cfm).nodes + nodes |= NodeRange( + grpcfg['noderange']['value'], self.cfm).nodes return nodes if '-' in element and ':' not in element: return self.expandrange(element, '-') diff --git a/confluent_server/confluent/plugins/configuration/attributes.py b/confluent_server/confluent/plugins/configuration/attributes.py index 59d6e719..9ee0f149 100644 --- a/confluent_server/confluent/plugins/configuration/attributes.py +++ b/confluent_server/confluent/plugins/configuration/attributes.py @@ -55,6 +55,8 @@ def retrieve_nodegroup(nodegroup, element, configmanager, inputdata): currattr = grpcfg[attribute] if attribute == 'nodes': desc = 'The nodes belonging to this group' + elif attribute == 'noderange': + desc = 'A dynamic noderange that this group refers to in noderange expansion' else: try: desc = allattributes.node[attribute]['description']