mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 19:10:10 +00:00
Enumerate nodegroups
This commit is contained in:
parent
5e406d6fa1
commit
7752bbbc27
@ -405,6 +405,11 @@ class ConfigManager(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_groups(self):
|
||||
if 'groups' not in self._cfgstore:
|
||||
return []
|
||||
return self._cfgstore['groups'].iterkeys()
|
||||
|
||||
def get_nodes(self):
|
||||
if 'nodes' not in self._cfgstore:
|
||||
return []
|
||||
|
@ -231,7 +231,6 @@ class ListAttributes(ConfluentMessage):
|
||||
}
|
||||
|
||||
class CryptedAttributes(Attributes):
|
||||
defaultvalue = 'dummyvalue'
|
||||
defaulttype = 'password'
|
||||
|
||||
def __init__(self, node, kv):
|
||||
|
@ -134,6 +134,11 @@ def handle_path(path, operation, configmanager, inputdata=None):
|
||||
del pathcomponents[-1]
|
||||
if not pathcomponents: #root collection list
|
||||
return enumerate_collections(rootcollections)
|
||||
elif pathcomponents[0] == 'nodegroup':
|
||||
try:
|
||||
group = pathcomponents[1]
|
||||
except IndexError:
|
||||
return iterate_collections(configmanager.get_groups())
|
||||
elif pathcomponents[0] in ('node', 'system', 'vm'):
|
||||
#single node request of some sort
|
||||
try:
|
||||
|
@ -8,11 +8,16 @@ def retrieve(nodes, element, configmanager, inputdata):
|
||||
for attribute in sorted(allattributes.node.iterkeys()):
|
||||
if attribute in attributes[node]: #have a setting for it
|
||||
val = attributes[node][attribute]
|
||||
elif attribute == 'groups': # no setting, provide a blank
|
||||
val = []
|
||||
else: # no setting, provide a blank
|
||||
val = {'value': '', 'cryptvalue': ''}
|
||||
if attribute.startswith('secret.'):
|
||||
yield msg.CryptedAttributes(node,
|
||||
{attribute: val})
|
||||
elif isinstance(val, list):
|
||||
yield msg.ListAttributes(node,
|
||||
{attribute: val})
|
||||
else:
|
||||
yield msg.Attributes(node,
|
||||
{attribute: val['value']})
|
||||
|
Loading…
Reference in New Issue
Block a user