From b661919b172f25d9a8f47e3131497c947fa21a9f Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Thu, 9 Feb 2012 00:15:10 +0000 Subject: Adding traceback to async faults Fixes bug 930278 Change-Id: If70922e07c68275459d0d3ca8d7cfc6fee20f425 --- nova/api/openstack/compute/views/servers.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/views/servers.py b/nova/api/openstack/compute/views/servers.py index f3fbee11f..d20cd26d3 100644 --- a/nova/api/openstack/compute/views/servers.py +++ b/nova/api/openstack/compute/views/servers.py @@ -187,9 +187,19 @@ class ViewBuilder(common.ViewBuilder): if not fault: return None - return { + fault_dict = { "code": fault["code"], "created": utils.isotime(fault["created_at"]), "message": fault["message"], - "details": fault["details"], } + + if fault.get('details', None): + is_admin = False + context = getattr(request, 'context', None) + if context: + is_admin = getattr(request.context, 'is_admin', False) + + if is_admin or fault['code'] != 500: + fault_dict['details'] = fault["details"] + + return fault_dict -- cgit