diff --git a/confluent/messages.py b/confluent/messages.py index ea9e2aac..00966e32 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -66,6 +66,11 @@ class InputAttributes(ConfluentMessage): for node in nodes: self.nodeattribs[node] = inputdata + def get_attributes(self, node): + if node not in self.nodeattribs: + return {} + return self.nodeattribs[node] + class InputPowerMessage(ConfluentMessage): valid_powerstates = set([ diff --git a/plugins/configuration/attributes.py b/plugins/configuration/attributes.py index 33ab65b6..ca036f17 100644 --- a/plugins/configuration/attributes.py +++ b/plugins/configuration/attributes.py @@ -14,5 +14,12 @@ def retrieve(nodes, element, configmanager, inputdata): else: print repr(currattr) raise Exception("BUGGY ATTRIBUTE FOR NODE") - - + + +def update(nodes, element, configmanager, inputdata): + updatedict = {} + for node in nodes: + updatenode = inputdata.get_attributes(node) + if updatenode: + updatedict[node] = updatenode + configmanager.set_node_attributes(updatedict)