diff --git a/confluent/config/configmanager.py b/confluent/config/configmanager.py index 9a574249..85a31ef6 100644 --- a/confluent/config/configmanager.py +++ b/confluent/config/configmanager.py @@ -563,11 +563,10 @@ class ConfigManager(object): recalcexpressions = False for attrname in attribmap[node].iterkeys(): newdict = {} - if (isinstance(attribmap[node][attrname], dict) or - isinstance(attribmap[node][attrname], set)): - newdict = attribmap[node][attrname] - else: + if (isinstance(attribmap[node][attrname], str)): newdict = {'value': attribmap[node][attrname] } + else: + newdict = attribmap[node][attrname] if 'value' in newdict and attrname.startswith("secret."): newdict['cryptvalue' ] = crypt_value(newdict['value']) del newdict['value'] diff --git a/confluent/messages.py b/confluent/messages.py index 5e9a6e85..9ea85ecd 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -33,6 +33,18 @@ class ConfluentMessage(object): value = val['value'] if 'note' in val: note = '(' + val['note'] + ')' + if isinstance(val, list): + snippet += key + ":" + for v in val: + snippet += \ + '%s' % ( + type, key, v, note) + snippet += \ + '%s' % ( + type, key, note) + snippet += '%s' % ( type, key, value, note) @@ -212,6 +224,12 @@ class Attributes(ConfluentMessage): node: nkv } +class ListAttributes(ConfluentMessage): + def __init__(self, node, kv): + self .kvpairs = { + node: kv + } + class CryptedAttributes(Attributes): defaultvalue = 'dummyvalue' defaulttype = 'password' diff --git a/plugins/configuration/attributes.py b/plugins/configuration/attributes.py index 78fd93db..58445a39 100644 --- a/plugins/configuration/attributes.py +++ b/plugins/configuration/attributes.py @@ -26,6 +26,9 @@ def retrieve(nodes, element, configmanager, inputdata): elif 'cryptvalue' in currattr: yield msg.CryptedAttributes(node, {attribute: currattr['cryptvalue']}) + elif isinstance(currattr, list): + yield msg.ListAttributes(node, + {attribute: currattr}) else: print repr(currattr) raise Exception("BUGGY ATTRIBUTE FOR NODE")