diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-11-27 12:31:16 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-11-27 12:31:16 +0000 |
commit | 527dc943c8a805c3917b9833ea4843abdae061d8 (patch) | |
tree | 831b2df8403f23c466552ec53e665fee9b23c98b | |
parent | 37816a0e63ed48ed3763e8c312fbb42c14b92167 (diff) | |
parent | 37d36f1536944de38a0f7a726e625b893088e1be (diff) | |
download | ironic-527dc943c8a805c3917b9833ea4843abdae061d8.tar.gz |
Merge "Avoid RequestContextSerializer from oslo.messaging"
-rw-r--r-- | ironic/common/rpc.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ironic/common/rpc.py b/ironic/common/rpc.py index 32b256c7b..212bec699 100644 --- a/ironic/common/rpc.py +++ b/ironic/common/rpc.py @@ -75,7 +75,24 @@ def get_allowed_exmods(): return ALLOWED_EXMODS + EXTRA_EXMODS -class RequestContextSerializer(messaging.RequestContextSerializer): +class RequestContextSerializer(messaging.Serializer): + + def __init__(self, base): + self._base = base + + def serialize_entity(self, context, entity): + if not self._base: + return entity + return self._base.serialize_entity(context, entity) + + def deserialize_entity(self, context, entity): + if not self._base: + return entity + return self._base.deserialize_entity(context, entity) + + def serialize_context(self, context): + return context.to_dict() + def deserialize_context(self, context): return ironic_context.RequestContext.from_dict(context) |