diff options
author | Sandy Walsh <sandy@sandywalsh.com> | 2013-01-08 16:20:12 -0600 |
---|---|---|
committer | Sandy Walsh <sandy.walsh@rackspace.com> | 2013-01-14 10:53:29 -0500 |
commit | d1f121265badfffd097ee983d14989b885375a0e (patch) | |
tree | 8e08762772a1afdebc5aa0521111b474e0ffcf4b /nova/exception.py | |
parent | ca4b1303804e94f10f0e4e6c4a9e09c049efd1ee (diff) | |
download | nova-d1f121265badfffd097ee983d14989b885375a0e.tar.gz nova-d1f121265badfffd097ee983d14989b885375a0e.tar.xz nova-d1f121265badfffd097ee983d14989b885375a0e.zip |
Keep self and context out of error notification payload.
Back in the day, having self and context in the error notifications
was handy for debugging. Now, there is a lot of confidential stuff
stored in these objects (especially when self = ComputeManager) ...
like passwords, etc.
This patch strips it out.
Also removes dead wrap_exception calls (which did nothing since they
did not specify a notifier).
Change-Id: Ieab7bd79b64e01c7bca18dbce97455e50094871c
Diffstat (limited to 'nova/exception.py')
-rw-r--r-- | nova/exception.py | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/nova/exception.py b/nova/exception.py index 7ec23d32d..f96b1eaf3 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -82,9 +82,11 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None, # to pass it in as a parameter. Otherwise we get a cyclic import of # nova.notifier.api -> nova.utils -> nova.exception :( def inner(f): - def wrapped(*args, **kw): + def wrapped(self, context, *args, **kw): + # Don't store self or context in the payload, it now seems to + # contain confidential information. try: - return f(*args, **kw) + return f(self, context, *args, **kw) except Exception, e: with excutils.save_and_reraise_exception(): if notifier: @@ -104,10 +106,6 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None, # propagated. temp_type = f.__name__ - context = get_context_from_function_and_args(f, - args, - kw) - notifier.notify(context, publisher_id, temp_type, temp_level, payload) @@ -1089,20 +1087,3 @@ class CryptoCAFileNotFound(FileNotFound): class CryptoCRLFileNotFound(FileNotFound): message = _("The CRL file for %(project)s could not be found") - - -def get_context_from_function_and_args(function, args, kwargs): - """Find an arg of type RequestContext and return it. - - This is useful in a couple of decorators where we don't - know much about the function we're wrapping. - """ - - # import here to avoid circularity: - from nova import context - - for arg in itertools.chain(kwargs.values(), args): - if isinstance(arg, context.RequestContext): - return arg - - return None |