Fix url_path
1. Replace /v1/deployables with /v1/accelerators/deployables. 2. Replace base_url with api_name. 3. Fix update body. Change-Id: I82bab30d4d880580755e176f751fd5a075975232
This commit is contained in:
parent
a77957d789
commit
16bdd7cccf
@ -24,4 +24,5 @@ class Accelerator(basemodels.BaseModel):
|
||||
|
||||
class AcceleratorManager(basemodels.BaseModelManager):
|
||||
api_name = "accelerators"
|
||||
base_url = "accelerators"
|
||||
resource_class = Accelerator
|
||||
|
@ -33,15 +33,16 @@ class BaseModel(base.Resource):
|
||||
|
||||
|
||||
class BaseModelManager(base.Manager):
|
||||
# api_name needs to be overridden by any derived class.
|
||||
# api_name should be pluralized and lowercase, e.g. "clustertemplates", as
|
||||
# it shows up in the URL path: "/v1/{api_name}"
|
||||
# base_url needs to be overridden by any derived class.
|
||||
# base_url should be pluralized and lowercase, e.g. "clustertemplates", as
|
||||
# it shows up in the URL path: "/v1/{base_url}"
|
||||
api_name = ''
|
||||
base_url = ''
|
||||
|
||||
@classmethod
|
||||
def _path(cls, id=None):
|
||||
return '/v1/' + cls.api_name + \
|
||||
'/%s' % id if id else '/v1/' + cls.api_name
|
||||
return '/v1/' + cls.base_url + \
|
||||
'/%s' % id if id else '/v1/' + cls.base_url
|
||||
|
||||
def list(self, limit=None, marker=None, sort_key=None,
|
||||
sort_dir=None, detail=False):
|
||||
|
@ -24,6 +24,7 @@ class Deployable(basemodels.BaseModel):
|
||||
|
||||
class DeployableManager(basemodels.BaseModelManager):
|
||||
api_name = "deployables"
|
||||
base_url = "accelerators/deployables"
|
||||
resource_class = Deployable
|
||||
|
||||
def deallocation(self, deployable_uuid):
|
||||
@ -32,12 +33,12 @@ class DeployableManager(basemodels.BaseModelManager):
|
||||
:param deployable_uuid: deployable_uuid which is attached to the
|
||||
instance.
|
||||
"""
|
||||
body = {"op": "replace", "path": "/instance_uuid", "value": None}
|
||||
resp = self._update("/deployables/%s" % deployable_uuid, body)
|
||||
body = [{"op": "replace", "path": "/instance_uuid", "value": None}]
|
||||
resp = self.update(deployable_uuid, body)
|
||||
return resp
|
||||
|
||||
def allocation(self, deployable_uuid, instance_uuid):
|
||||
body = {"op": "replace", "path": "/instance_uuid",
|
||||
"value": instance_uuid}
|
||||
resp = self._update("/deployables/%s" % deployable_uuid, body)
|
||||
body = [{"op": "replace", "path": "/instance_uuid",
|
||||
"value": instance_uuid}]
|
||||
resp = self.update(deployable_uuid, body)
|
||||
return resp
|
||||
|
Loading…
Reference in New Issue
Block a user