From 43e119bf5e2b8fa5b66282ffcdc18661aa4a1649 Mon Sep 17 00:00:00 2001 From: David Xie Date: Wed, 11 Sep 2013 21:54:47 +0800 Subject: [PATCH] Wrong arguments when calling safe_utils.getcallargs() When calling safe_utils.getcallargs(), it will get all argnames from definition of a function. As every function in Nova has a argument named `context`, so argnames will always start with `context`. In nova/exception.py#81, *args is a list of arguments which does not start with `context`, however, argnames starts with `context`, this will lead to a mismatching when zip it into a dict. Solution for this is that when calling getcallargs(), pass context as one argument. Change-Id: I4ce81e1862fb2d741f15747b04aa6bf1a2243364 Fixes: bug #1207153 --- nova/exception.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/exception.py b/nova/exception.py index 101b129fa..4dc7e2830 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -75,7 +75,8 @@ def wrap_exception(notifier=None, get_notifier=None): with excutils.save_and_reraise_exception(): if notifier or get_notifier: payload = dict(exception=e) - call_dict = safe_utils.getcallargs(f, *args, **kw) + call_dict = safe_utils.getcallargs(f, context, + *args, **kw) cleansed = _cleanse_dict(call_dict) payload.update({'args': cleansed})