Hook up the update and delete (not quite working)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
a321e3c880
commit
a76d02e790
|
@ -25,12 +25,7 @@ logger = logging.getLogger(__name__)
|
||||||
class API(wsgi.Router):
|
class API(wsgi.Router):
|
||||||
|
|
||||||
"""WSGI router for Heat v1 API requests."""
|
"""WSGI router for Heat v1 API requests."""
|
||||||
#TODO
|
#TODO GetTemplate, ValidateTemplate
|
||||||
#DeleteStack
|
|
||||||
#GetTemplate
|
|
||||||
#UpdateStack
|
|
||||||
#ValidateTemplate
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, conf, **local_conf):
|
def __init__(self, conf, **local_conf):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
|
@ -48,5 +43,9 @@ class API(wsgi.Router):
|
||||||
action="list", conditions=dict(method=["GET"]))
|
action="list", conditions=dict(method=["GET"]))
|
||||||
mapper.connect("/DescribeStacks", controller=stacks_resource,
|
mapper.connect("/DescribeStacks", controller=stacks_resource,
|
||||||
action="describe", conditions=dict(method=["GET"]))
|
action="describe", conditions=dict(method=["GET"]))
|
||||||
|
mapper.connect("/DeleteStack", controller=stacks_resource,
|
||||||
|
action="delete", conditions=dict(method=["DELETE"]))
|
||||||
|
mapper.connect("/UpdateStack", controller=stacks_resource,
|
||||||
|
action="update", conditions=dict(method=["PUT"]))
|
||||||
|
|
||||||
super(API, self).__init__(mapper)
|
super(API, self).__init__(mapper)
|
||||||
|
|
|
@ -253,13 +253,14 @@ class StackController(object):
|
||||||
for s in stack_db:
|
for s in stack_db:
|
||||||
mem = {}
|
mem = {}
|
||||||
mem['StackId'] = stack_db[s]['StackId']
|
mem['StackId'] = stack_db[s]['StackId']
|
||||||
mem['StackStatus'] = 'happy'
|
|
||||||
mem['StackName'] = s
|
mem['StackName'] = s
|
||||||
mem['CreationTime'] = 'now'
|
mem['CreationTime'] = 'now'
|
||||||
try:
|
try:
|
||||||
mem['TemplateDescription'] = stack_db[s]['Description']
|
mem['TemplateDescription'] = stack_db[s]['Description']
|
||||||
|
mem['StackStatus'] = stack_db[s]['StackStatus']
|
||||||
except:
|
except:
|
||||||
mem['TemplateDescription'] = 'No description'
|
mem['TemplateDescription'] = 'No description'
|
||||||
|
mem['StackStatus'] = 'unknown'
|
||||||
summaries.append(mem)
|
summaries.append(mem)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -379,6 +380,12 @@ class StackController(object):
|
||||||
:raises HttpNotAuthorized if object is not
|
:raises HttpNotAuthorized if object is not
|
||||||
deleteable by the requesting user
|
deleteable by the requesting user
|
||||||
"""
|
"""
|
||||||
|
logger.info('in delete %s ' % req.params['StackName']
|
||||||
|
if not stack_db.has_key(req.params['StackName']):
|
||||||
|
msg = _("Stack does not exist with that name.")
|
||||||
|
return webob.exc.HTTPNotFound(msg)
|
||||||
|
|
||||||
|
del stack_db[req.params['StackName']]
|
||||||
|
|
||||||
def create_resource(options):
|
def create_resource(options):
|
||||||
"""Stacks resource factory method"""
|
"""Stacks resource factory method"""
|
||||||
|
|
|
@ -72,11 +72,16 @@ class V1Client(base_client.BaseClient):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def update_stack(self, **kwargs):
|
def update_stack(self, **kwargs):
|
||||||
return
|
params = self._extract_params(kwargs, SUPPORTED_PARAMS)
|
||||||
|
self._insert_common_parameters(params)
|
||||||
|
res = self.do_request("PUT", "/UpdateStack", params=params)
|
||||||
|
|
||||||
|
data = json.loads(res.read())
|
||||||
|
return data
|
||||||
|
|
||||||
def delete_stack(self, **kwargs):
|
def delete_stack(self, **kwargs):
|
||||||
self._insert_common_parameters(params)
|
|
||||||
params = self._extract_params(kwargs, SUPPORTED_PARAMS)
|
params = self._extract_params(kwargs, SUPPORTED_PARAMS)
|
||||||
|
self._insert_common_parameters(params)
|
||||||
self.do_request("DELETE", "/DeleteStack", params)
|
self.do_request("DELETE", "/DeleteStack", params)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue