Skip to content

Commit

Permalink
Merge "enables admin to view instance fault "details""
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jan 17, 2013
2 parents 01f204e + 6130aac commit 65d7543
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nova/api/openstack/compute/views/servers.py
Expand Up @@ -211,9 +211,9 @@ def _get_fault(self, request, instance):

if fault.get('details', None):
is_admin = False
context = getattr(request, 'context', None)
context = request.environ["nova.context"]
if context:
is_admin = getattr(request.context, 'is_admin', False)
is_admin = getattr(context, 'is_admin', False)

if is_admin or fault['code'] != 500:
fault_dict['details'] = fault["details"]
Expand Down
4 changes: 2 additions & 2 deletions nova/tests/api/openstack/compute/test_servers.py
Expand Up @@ -4008,7 +4008,7 @@ def test_build_server_detail_with_fault_admin(self):
"message": "Error",
'details': 'Stock details for test'}

self.request.context = context.get_admin_context()
self.request.environ['nova.context'].is_admin = True
output = self.view_builder.show(self.request, self.instance)
self.assertThat(output['server']['fault'],
matchers.DictMatches(expected_fault))
Expand All @@ -4027,7 +4027,7 @@ def test_build_server_detail_with_fault_no_details_admin(self):
"created": "2010-10-10T12:00:00Z",
"message": "Error"}

self.request.context = context.get_admin_context()
self.request.environ['nova.context'].is_admin = True
output = self.view_builder.show(self.request, self.instance)
self.assertThat(output['server']['fault'],
matchers.DictMatches(expected_fault))
Expand Down

0 comments on commit 65d7543

Please sign in to comment.