Merge "Pass the actual target in os-agents policy"
This commit is contained in:
commit
15974f476f
|
@ -52,7 +52,7 @@ class AgentController(wsgi.Controller):
|
||||||
def index(self, req):
|
def index(self, req):
|
||||||
"""Return a list of all agent builds. Filter by hypervisor."""
|
"""Return a list of all agent builds. Filter by hypervisor."""
|
||||||
context = req.environ['nova.context']
|
context = req.environ['nova.context']
|
||||||
context.can(agents_policies.BASE_POLICY_NAME % 'list')
|
context.can(agents_policies.BASE_POLICY_NAME % 'list', target={})
|
||||||
hypervisor = None
|
hypervisor = None
|
||||||
agents = []
|
agents = []
|
||||||
if 'hypervisor' in req.GET:
|
if 'hypervisor' in req.GET:
|
||||||
|
@ -75,7 +75,7 @@ class AgentController(wsgi.Controller):
|
||||||
def update(self, req, id, body):
|
def update(self, req, id, body):
|
||||||
"""Update an existing agent build."""
|
"""Update an existing agent build."""
|
||||||
context = req.environ['nova.context']
|
context = req.environ['nova.context']
|
||||||
context.can(agents_policies.BASE_POLICY_NAME % 'update')
|
context.can(agents_policies.BASE_POLICY_NAME % 'update', target={})
|
||||||
|
|
||||||
# TODO(oomichi): This parameter name "para" is different from the ones
|
# TODO(oomichi): This parameter name "para" is different from the ones
|
||||||
# of the other APIs. Most other names are resource names like "server"
|
# of the other APIs. Most other names are resource names like "server"
|
||||||
|
@ -118,7 +118,7 @@ class AgentController(wsgi.Controller):
|
||||||
def delete(self, req, id):
|
def delete(self, req, id):
|
||||||
"""Deletes an existing agent build."""
|
"""Deletes an existing agent build."""
|
||||||
context = req.environ['nova.context']
|
context = req.environ['nova.context']
|
||||||
context.can(agents_policies.BASE_POLICY_NAME % 'delete')
|
context.can(agents_policies.BASE_POLICY_NAME % 'delete', target={})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
utils.validate_integer(id, 'id')
|
utils.validate_integer(id, 'id')
|
||||||
|
@ -140,7 +140,7 @@ class AgentController(wsgi.Controller):
|
||||||
def create(self, req, body):
|
def create(self, req, body):
|
||||||
"""Creates a new agent build."""
|
"""Creates a new agent build."""
|
||||||
context = req.environ['nova.context']
|
context = req.environ['nova.context']
|
||||||
context.can(agents_policies.BASE_POLICY_NAME % 'create')
|
context.can(agents_policies.BASE_POLICY_NAME % 'create', target={})
|
||||||
|
|
||||||
agent = body['agent']
|
agent = body['agent']
|
||||||
hypervisor = agent['hypervisor']
|
hypervisor = agent['hypervisor']
|
||||||
|
|
Loading…
Reference in New Issue