2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Fix range operator not validating nodes

When a node that doesn't exist is implied by a noderange, correctly indicate failure when
config verification is engaged.
This commit is contained in:
Jarrod Johnson 2015-03-13 14:11:54 -04:00
parent 9f16375b14
commit 50274f745e

View File

@ -116,9 +116,24 @@ class NodeRange(object):
curseq.append(numformat.format(num))
results = set([])
for combo in itertools.product(*iterators):
results.add(finalfmt.format(*combo))
entname = finalfmt.format(*combo)
results |= self.expand_entity(entname)
return results
def expand_entity(self, entname):
if self.cfm is None or self.cfm.is_node(entname):
return set([entname])
if self.cfm.is_node(entname):
return set([entname])
if self.cfm.is_nodegroup(entname):
nodes = set([])
grpcfg = self.cfm.get_nodegroup_attributes(entname)
nodes = grpcfg['nodes']
if 'noderange' in grpcfg and grpcfg['noderange']:
nodes |= NodeRange(
grpcfg['noderange']['value'], self.cfm).nodes
return nodes
def _expandstring(self, element):
prefix = ''
for idx in xrange(len(element)):