Change in vdsm[master]: rpc: Make Bridge#_type_fixup more robust

mbetak at redhat.com mbetak at redhat.com
Thu Apr 28 14:09:34 UTC 2016


Martin Betak has uploaded a new change for review.

Change subject: rpc: Make Bridge#_type_fixup more robust
......................................................................

rpc: Make Bridge#_type_fixup more robust

_type_fixup method assumed that all top-level arguments of rpc calls are
dictionaries thus failing with arguments of type e.g. 'int'.

This patch fixes this issues and only recurses deeper if the 'item'
itself is a dictionary.

Change-Id: I5871f6c08fe384f52bfa190a44290e2489f06981
Signed-off-by: Martin Betak <mbetak at redhat.com>
---
M lib/vdsm/rpc/Bridge.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/56811/1

diff --git a/lib/vdsm/rpc/Bridge.py b/lib/vdsm/rpc/Bridge.py
index 948787e..4ad7b26 100644
--- a/lib/vdsm/rpc/Bridge.py
+++ b/lib/vdsm/rpc/Bridge.py
@@ -17,6 +17,7 @@
 from __future__ import absolute_import
 from functools import partial
 
+import collections
 import inspect
 import logging
 import threading
@@ -204,7 +205,8 @@
                 typefixups[symTypeName](item)
             for (k, v) in symbol.get('data', {}).items():
                 k = self._sym_name_filter(k)
-                if k in item:
+                # first check if the 'item' supports indexing
+                if isinstance(item, collections.Iterable) and k in item:
                     self._type_fixup(k, v, item[k])
 
     def _fixup_args(self, className, methodName, args):


-- 
To view, visit https://gerrit.ovirt.org/56811
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5871f6c08fe384f52bfa190a44290e2489f06981
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak at redhat.com>


More information about the vdsm-patches mailing list