Merge "Ensure we pass a target in admin actions"
This commit is contained in:
commit
c9e9b4311b
|
@ -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"]]
|
||||
|
|
Loading…
Reference in New Issue