summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-08-12 02:45:46 +0000
committerGerrit Code Review <review@openstack.org>2013-08-12 02:45:46 +0000
commit2efa0edaf921cc78a7fcfaf3eb3e2c0ca105aa83 (patch)
treec26fe055c58179f8a7725567b6a75d1566379e36 /openstack
parentc2aabfa238960233e5d3cd5da62168813e80d7dd (diff)
parent61c4cdec304d79f43c8a549c2543c939492c4812 (diff)
downloadoslo-2efa0edaf921cc78a7fcfaf3eb3e2c0ca105aa83.tar.gz
oslo-2efa0edaf921cc78a7fcfaf3eb3e2c0ca105aa83.tar.xz
oslo-2efa0edaf921cc78a7fcfaf3eb3e2c0ca105aa83.zip
Merge "Ensure context type is handled when using to_dict"
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/rpc/amqp.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/openstack/common/rpc/amqp.py b/openstack/common/rpc/amqp.py
index 1afd2ab..38f2515 100644
--- a/openstack/common/rpc/amqp.py
+++ b/openstack/common/rpc/amqp.py
@@ -300,8 +300,13 @@ def pack_context(msg, context):
for args at some point.
"""
- context_d = dict([('_context_%s' % key, value)
- for (key, value) in context.to_dict().iteritems()])
+ if isinstance(context, dict):
+ context_d = dict([('_context_%s' % key, value)
+ for (key, value) in context.iteritems()])
+ else:
+ context_d = dict([('_context_%s' % key, value)
+ for (key, value) in context.to_dict().iteritems()])
+
msg.update(context_d)