Make the "heat delete" command work.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
986e39c3b6
commit
1f861a50cd
@ -119,6 +119,7 @@ class StacksController(object):
|
||||
return webob.exc.HTTPNotFound('No stack by that name')
|
||||
|
||||
logger.info('deleting stack %s' % id)
|
||||
stack_db[id].stop()
|
||||
del stack_db[id]
|
||||
return None
|
||||
|
||||
|
@ -103,6 +103,10 @@ class Stack:
|
||||
#print 'calling start [stack->%s]' % (self.resources[r].name)
|
||||
self.resources[r].start()
|
||||
|
||||
def stop(self):
|
||||
for r in self.t['Resources']:
|
||||
self.resources[r].stop()
|
||||
|
||||
def calulate_dependencies(self, s, r):
|
||||
if isinstance(s, dict):
|
||||
for i in s:
|
||||
|
@ -316,6 +316,29 @@ class Instance(Resource):
|
||||
else:
|
||||
self.state_set(self.CREATE_FAILED)
|
||||
|
||||
def stop(self):
|
||||
|
||||
if self.state == self.DELETE_IN_PROGRESS or self.state == self.DELETE_COMPLETE:
|
||||
return
|
||||
self.state_set(self.DELETE_IN_PROGRESS)
|
||||
Resource.stop(self)
|
||||
|
||||
if self.instance_id == None:
|
||||
self.state_set(self.DELETE_COMPLETE)
|
||||
return
|
||||
|
||||
username = self.stack.creds['username']
|
||||
password = self.stack.creds['password']
|
||||
tenant = self.stack.creds['tenant']
|
||||
auth_url = self.stack.creds['auth_url']
|
||||
|
||||
nova_client = client.Client(username, password, tenant, auth_url, service_type='compute', service_name='nova')
|
||||
server = nova_client.servers.get(self.instance_id)
|
||||
server.delete()
|
||||
self.instance_id = None
|
||||
self.state_set(self.DELETE_COMPLETE)
|
||||
|
||||
|
||||
def insert_package_and_services(self, r, new_script):
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user