From 37d36f1536944de38a0f7a726e625b893088e1be Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 26 Nov 2015 20:48:44 -0500 Subject: [PATCH] Avoid RequestContextSerializer from oslo.messaging Oslo.messaging is in the process of removing the class starting with the change id: I21d76abf1c30b9e89cb8a6c20d1c0cc79cd83a3f So ironic should just use its own class. Note that the next oslo.messaging release will break ironic based on some local testing. Change-Id: I618fdc3024b3bc16515216bda900804f4cebba7d --- ironic/common/rpc.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ironic/common/rpc.py b/ironic/common/rpc.py index 32b256c7be..212bec699c 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)