cloudstack: fix state=expunged in cs_instance

This commit is contained in:
Rene Moser 2015-06-26 11:56:28 +02:00 committed by Matt Clay
parent cbfc5a3079
commit 4020ebaecf

View file

@ -633,7 +633,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
if instance['state'].lower() in [ 'destroying', 'destroyed' ]: if instance['state'].lower() in [ 'destroying', 'destroyed' ]:
self.result['changed'] = True self.result['changed'] = True
if not self.module.check_mode: if not self.module.check_mode:
res = self.cs.expungeVirtualMachine(id=instance['id']) res = self.cs.destroyVirtualMachine(id=instance['id'], expunge=True)
elif instance['state'].lower() not in [ 'expunging' ]: elif instance['state'].lower() not in [ 'expunging' ]:
self.result['changed'] = True self.result['changed'] = True
@ -645,7 +645,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
poll_async = self.module.params.get('poll_async') poll_async = self.module.params.get('poll_async')
if poll_async: if poll_async:
instance = self._poll_job(res, 'virtualmachine') res = self._poll_job(res, 'virtualmachine')
return instance return instance