diff --git a/confluent/config/attributes.py b/confluent/config/attributes.py index 37c27c43..62bf2802 100644 --- a/confluent/config/attributes.py +++ b/confluent/config/attributes.py @@ -52,7 +52,7 @@ nic = { # 'node', which can be considered a 'system' or a 'vm' node = { 'groups': { - 'type': (list, tuple), + 'type': list, 'default': 'all', 'description': ('List of static groups for which this node is ' 'considered a member'), diff --git a/confluent/config/configmanager.py b/confluent/config/configmanager.py index dc6750e0..fb2f23e4 100644 --- a/confluent/config/configmanager.py +++ b/confluent/config/configmanager.py @@ -575,7 +575,7 @@ class ConfigManager(object): for attrname in attribmap[node].iterkeys(): if (attrname not in attributes.node or ('type' in attributes.node[attrname] and - type(attribmap[node][attrname]) not in attributes.node[attrname]['type'])): + not isinstance(attribmap[node][attrname],attributes.node[attrname]['type'])): raise ValueError newdict = {} if (isinstance(attribmap[node][attrname], str)): diff --git a/confluent/httpapi.py b/confluent/httpapi.py index debd4dd7..72a216dd 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -38,11 +38,15 @@ def node_creation_resources(): if attr.startswith("secret."): yield confluent.messages.CryptedAttributes( kv={attr: None}, - desc=attribs.node[attr]['description']).html() + '
' + desc=attribs.node[attr]['description']).html() + '
\n' + elif 'type' in attribs.node[attr] and list == attribs.node[attr]['type']: + yield confluent.messages.ListAttributes( + kv={attr: []}, + desc=attribs.node[attr]['description']).html() + '
\n' else: yield confluent.messages.Attributes( kv={attr: None}, - desc=attribs.node[attr]['description']).html() + '
' + desc=attribs.node[attr]['description']).html() + '
\n' create_resource_functions = { '/node/': node_creation_resources, diff --git a/confluent/messages.py b/confluent/messages.py index 44cb5969..d20c0e99 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -45,6 +45,10 @@ class ConfluentMessage(object): value = '********' if isinstance(val, list): snippet += key + ":" + if len(val) == 0: + snippet += ('' + ).format(type, key, self.desc) for v in val: snippet += ('' @@ -274,11 +278,12 @@ class Attributes(ConfluentMessage): class ListAttributes(ConfluentMessage): - def __init__(self, node, kv, desc=''): + def __init__(self, node=None, kv=None, desc=''): self.desc = desc - self .kvpairs = { - node: kv - } + if node is None: + self.kvpairs = kv + else: + self .kvpairs = {node: kv} class CryptedAttributes(Attributes):