Some small nits for profiles.py
This commit is contained in:
parent
831eae517a
commit
a6f3090d14
@ -15,6 +15,7 @@
|
|||||||
"profiles:create": "",
|
"profiles:create": "",
|
||||||
"profiles:get": "rule:admin_or_owner",
|
"profiles:get": "rule:admin_or_owner",
|
||||||
"profiles:delete": "rule:admin_or_owner",
|
"profiles:delete": "rule:admin_or_owner",
|
||||||
|
"profiles:update": "rule:admin_or_owner",
|
||||||
"nodes:index": "rule:admin_or_owner",
|
"nodes:index": "rule:admin_or_owner",
|
||||||
"nodes:create": "",
|
"nodes:create": "",
|
||||||
"nodes:get": "rule:admin_or_owner",
|
"nodes:get": "rule:admin_or_owner",
|
||||||
|
@ -20,14 +20,11 @@ from senlin.api.openstack.v1 import util
|
|||||||
from senlin.common.i18n import _
|
from senlin.common.i18n import _
|
||||||
from senlin.common import serializers
|
from senlin.common import serializers
|
||||||
from senlin.common import wsgi
|
from senlin.common import wsgi
|
||||||
from senlin.openstack.common import log as logging
|
|
||||||
from senlin.rpc import client as rpc_client
|
from senlin.rpc import client as rpc_client
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ProfileData(object):
|
class ProfileData(object):
|
||||||
'''The data accompanying a PUT/POST request to create/update a profile.'''
|
'''The data accompanying a POST/PUT request to create/update a profile.'''
|
||||||
|
|
||||||
PARAMS = (
|
PARAMS = (
|
||||||
NAME, SPEC, TYPE, PERMISSION, TAGS,
|
NAME, SPEC, TYPE, PERMISSION, TAGS,
|
||||||
@ -54,14 +51,10 @@ class ProfileData(object):
|
|||||||
return self.data[self.TYPE]
|
return self.data[self.TYPE]
|
||||||
|
|
||||||
def permission(self):
|
def permission(self):
|
||||||
if self.PERMISSION not in self.data:
|
return self.data.get(self.PERMISSION)
|
||||||
return None
|
|
||||||
return self.data[self.PERMISSION]
|
|
||||||
|
|
||||||
def tags(self):
|
def tags(self):
|
||||||
if self.TAGS not in self.data:
|
return self.data.get(self.TAGS)
|
||||||
return None
|
|
||||||
return self.data[self.TAGS]
|
|
||||||
|
|
||||||
|
|
||||||
class ProfileController(object):
|
class ProfileController(object):
|
||||||
@ -125,10 +118,7 @@ class ProfileController(object):
|
|||||||
profile = self.rpc_client.profile_get(req.context,
|
profile = self.rpc_client.profile_get(req.context,
|
||||||
profile_id)
|
profile_id)
|
||||||
|
|
||||||
if not profile:
|
return {'profile': profile}
|
||||||
raise exc.HTTPInternalServerError()
|
|
||||||
|
|
||||||
return profile
|
|
||||||
|
|
||||||
@util.policy_enforce
|
@util.policy_enforce
|
||||||
def update(self, req, profile_id, body):
|
def update(self, req, profile_id, body):
|
||||||
|
Loading…
Reference in New Issue
Block a user