Merge "Ensure we pass a target in admin actions"

This commit is contained in:
Zuul 2020-04-03 02:14:35 +00:00 committed by Gerrit Code Review
commit c9e9b4311b
1 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class AdminActionsController(wsgi.Controller):
def _reset_network(self, req, id, body):
"""Permit admins to reset networking on a server."""
context = req.environ['nova.context']
context.can(aa_policies.POLICY_ROOT % 'reset_network')
context.can(aa_policies.POLICY_ROOT % 'reset_network', target={})
instance = common.get_instance(self.compute_api, context, id)
try:
self.compute_api.reset_network(context, instance)
@ -53,7 +53,7 @@ class AdminActionsController(wsgi.Controller):
def _inject_network_info(self, req, id, body):
"""Permit admins to inject network info into a server."""
context = req.environ['nova.context']
context.can(aa_policies.POLICY_ROOT % 'inject_network_info')
context.can(aa_policies.POLICY_ROOT % 'inject_network_info', target={})
instance = common.get_instance(self.compute_api, context, id)
try:
self.compute_api.inject_network_info(context, instance)
@ -67,7 +67,7 @@ class AdminActionsController(wsgi.Controller):
def _reset_state(self, req, id, body):
"""Permit admins to reset the state of a server."""
context = req.environ["nova.context"]
context.can(aa_policies.POLICY_ROOT % 'reset_state')
context.can(aa_policies.POLICY_ROOT % 'reset_state', target={})
# Identify the desired state from the body
state = state_map[body["os-resetState"]["state"]]