From 5410b394f2e23ea4f9c8dc7e92cbe0048ff55e33 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 14 Jul 2016 09:56:40 -0400 Subject: [PATCH] Fix 'unset' on noderange The Attributes management class was making shared shallow copies. This caused a problem when attributes class assumed it could modify the result. Correct by providing a deep copy of that node's data when it is requested. --- confluent_server/confluent/messages.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 029d6d2a..6dac39aa 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -19,6 +19,7 @@ # Things are defined here to 'encourage' developers to coordinate information # format. This is also how different data formats are supported import confluent.exceptions as exc +from copy import deepcopy from datetime import datetime import json @@ -418,7 +419,7 @@ class InputAttributes(ConfluentMessage): def get_attributes(self, node): if node not in self.nodeattribs: return {} - nodeattr = self.nodeattribs[node] + nodeattr = deepcopy(self.nodeattribs[node]) for attr in nodeattr: if type(nodeattr[attr]) in (str, unicode): try: @@ -492,7 +493,7 @@ class InputCredential(ConfluentMessage): def get_attributes(self, node): if node not in self.credentials: return {} - credential = self.credentials[node] + credential = deepcopy(self.credentials[node]) for attr in credential: if type(credential[attr]) in (str, unicode): try: