From 58482c60900d49c0cc8349ede6b841819fc56d00 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sun, 3 Nov 2013 10:21:54 -0500 Subject: [PATCH] Implement ability to change settings for an existing node --- confluent/messages.py | 5 +++++ plugins/configuration/attributes.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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)