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
This commit is contained in:
Jim Rollenhagen 2017-04-04 10:45:14 -04:00
parent a8abc54c1b
commit 25bfdcdd1f
1 changed files with 3 additions and 1 deletions

View File

@ -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