From 25bfdcdd1f51a24a6b4fb18b39329b748875090f Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Tue, 4 Apr 2017 10:45:14 -0400 Subject: [PATCH] Fix base object serialization checks We're missing unicode and long types in python 2 and bytes in python 3 here. These don't need to be serialized but will currently emit a warning log when we hit this path. Add these types (via six so we're compatible). Change-Id: Ifb0fba3a82d7b24c25893ba258c74a66630617d9 --- ironic/objects/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ironic/objects/base.py b/ironic/objects/base.py index a366623c6d..6cf7e5ecdc 100644 --- a/ironic/objects/base.py +++ b/ironic/objects/base.py @@ -17,6 +17,7 @@ from oslo_log import log from oslo_utils import versionutils from oslo_versionedobjects import base as object_base +import six from ironic.common import release_mappings as versions from ironic.conf import CONF @@ -137,6 +138,7 @@ class IronicObjectSerializer(object_base.VersionedObjectSerializer): # object version and entity's obj_make_compatible method is called # to backport the object before serialization. entity = entity.obj_to_primitive(target_version=target_version) - elif not isinstance(entity, (int, str, bool, float, type)) and entity: + elif not isinstance(entity, (bool, float, type, six.integer_types, + six.string_types)) and entity: LOG.warning("Entity %s was not serialized.", str(entity)) return entity