diff options
| author | Cerberus <matt.dietz@rackspace.com> | 2011-02-18 16:45:31 -0600 |
|---|---|---|
| committer | Cerberus <matt.dietz@rackspace.com> | 2011-02-18 16:45:31 -0600 |
| commit | 201391007e58b2f92fd7b56ccbf308e5909da7c0 (patch) | |
| tree | 7965568a97336d0817f47035504ec79bcf488a70 /plugins | |
| parent | a43c5929de7ebf58eb9ecb8416ce3cf4194c176a (diff) | |
| parent | 8de8d1d045ca9fe12596e53d2244f4f8703cc209 (diff) | |
| download | nova-201391007e58b2f92fd7b56ccbf308e5909da7c0.tar.gz nova-201391007e58b2f92fd7b56ccbf308e5909da7c0.tar.xz nova-201391007e58b2f92fd7b56ccbf308e5909da7c0.zip | |
Merge from trunk and merge conflict resolution
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 5 | ||||
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index f99ea4082..94eaabe73 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -93,9 +93,8 @@ def password(self, arg_dict): @jsonify def resetnetwork(self, arg_dict): - """ - Writes a resquest to xenstore that tells the agent to reset networking. - + """Writes a resquest to xenstore that tells the agent + to reset networking. """ arg_dict['value'] = json.dumps({'name': 'resetnetwork', 'value': ''}) request_id = arg_dict['id'] diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py index 695bf3448..a35ccd6ab 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py @@ -36,7 +36,15 @@ pluginlib.configure_logging("xenstore") def jsonify(fnc): def wrapper(*args, **kwargs): - return json.dumps(fnc(*args, **kwargs)) + ret = fnc(*args, **kwargs) + try: + json.loads(ret) + except ValueError: + # Value should already be JSON-encoded, but some operations + # may write raw sting values; this will catch those and + # properly encode them. + ret = json.dumps(ret) + return ret return wrapper |
