Fix obj_to_dict type filtering
Commit 88f5f2661ee2ba31056251b4cdf91949fca0a031 fixed the python 3 unit tests, but broke obj_to_dict() because client classes were no longer being filtered out (like nova's ServerManager class). Trying to remove these by using inspect.isclass() does not work as it does not recognize these types as classes (perhaps b/c they are being serialized?). This change reverts to the old style behaviour, but uses the six class to fix python3 compatibility. Change-Id: Ief7bba30d983f67cd28d886cd1d3dfd2a45e957d
This commit is contained in:
parent
c22531d54b
commit
70b58cff5c
@ -1,6 +1,7 @@
|
||||
pbr>=0.5.21,<1.0
|
||||
|
||||
os-client-config
|
||||
six
|
||||
|
||||
python-novaclient
|
||||
python-keystoneclient>=0.11.0
|
||||
|
@ -13,6 +13,11 @@
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import six
|
||||
|
||||
NON_CALLABLES = (six.string_types, bool, dict, int, list, type(None))
|
||||
|
||||
|
||||
def find_nova_addresses(addresses, ext_tag=None, key_name=None, version=4):
|
||||
|
||||
ret = []
|
||||
@ -133,6 +138,6 @@ def obj_to_dict(obj):
|
||||
instance = {}
|
||||
for key in dir(obj):
|
||||
value = getattr(obj, key)
|
||||
if not callable(value) and not key.startswith('_'):
|
||||
if isinstance(value, NON_CALLABLES) and not key.startswith('_'):
|
||||
instance[key] = value
|
||||
return instance
|
||||
|
Loading…
x
Reference in New Issue
Block a user