2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Fix expression detection with unicode strings

If data was coming in as unicode strings (as is the case in the json
parser), it failed to treat the data as equivalent to string.  Correct
by checking both str and unicode for now
This commit is contained in:
Jarrod Johnson 2014-03-01 10:48:08 -05:00
parent 96a7f197d6
commit 9bf68c1639
2 changed files with 24 additions and 3 deletions

21
BUGS
View File

@ -2,3 +2,24 @@
-Setting multiple values at once where one is an expression including the othe
can fail because the expression is attempted to set before
the next setting comes to work and then we get a stack trace
Should leave value out of it and set 'broken' with a reason as the
value to the key
-cannot set expression value through confetty
-expressionkeys never gets smaller - perf impact
-need event notification for config change- e.g. set attribute triggers consol
session object check to see if credentials changed
-When the time comes to dole out configuration/discovery, take page from xCAT
'flexdiscover' command, if possible bring an ipmi device under management
by way of ipv6 to eliminate requirement for ip to be specified.
Requires the polling event support (which is required for security anyway)
-this stack trace (happened with method was set to ""):
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/eventlet/wsgi.py", line 402, in handle_one_response
for data in result:
File "/home/jbjohnso/Development/confluent/confluent/httpapi.py", line 301, in resourcehandler
cfgmgr, querydict)
File "/home/jbjohnso/Development/confluent/confluent/pluginapi.py", line 273, in handle_path
passvalue = pluginmap[plugpath].__dict__[operation](
KeyError: ''

View File

@ -164,7 +164,7 @@ class InputAttributes(ConfluentMessage):
if nodes is None:
self.attribs = inputdata
for attrib in self.attribs:
if (type(self.attribs[attrib]) == str and
if (type(self.attribs[attrib]) in (str, unicode) and
'{' in self.attribs[attrib]):
self.attribs[attrib] = {'expression': self.attribs[attrib]}
return
@ -185,7 +185,7 @@ class InputAttributes(ConfluentMessage):
return {}
nodeattr = self.nodeattribs[node]
for attr in nodeattr:
if type(nodeattr[attr]) == str and '{' in nodeattr[attr]:
if type(nodeattr[attr]) in (str, unicode) and '{' in nodeattr[attr]:
nodeattr[attr] = {'expression': nodeattr[attr]}
return nodeattr
@ -290,7 +290,7 @@ class Attributes(ConfluentMessage):
self.desc = desc
nkv = {}
for key in kv.iterkeys():
if type(kv[key]) == str:
if type(kv[key]) in (str, unicode):
nkv[key] = {'value': kv[key]}
else:
nkv[key] = kv[key]