[PATCH conductor] Quick Fix, destroy method is not called for ec2 and Mock instances, or if instance is in CREATE_FAILED state
Tomas Sedovic
tsedovic at redhat.com
Tue Dec 13 10:04:29 UTC 2011
On 12/13/2011 10:37 AM, Tomas Hrcka wrote:
> ---
> src/app/models/instance.rb | 16 +++++++++-------
> 1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
> index 279e1a7..d146cce 100644
> --- a/src/app/models/instance.rb
> +++ b/src/app/models/instance.rb
> @@ -483,14 +483,16 @@ class Instance< ActiveRecord::Base
> ]
>
> def destroy_on_provider
> - begin
> - @task = self.queue_action(self.owner, 'destroy')
> - unless @task
> - raise ActionError.new("destroy cannot be performed on this instance.")
> + if (provider_account.label != "ec2" or provider_account.label != "mock") and state != STATE_CREATE_FAILED
> + begin
> + @task = self.queue_action(self.owner, 'destroy')
> + unless @task
> + raise ActionError.new("destroy cannot be performed on this instance.")
> + end
> + Taskomatic.destroy_instance(@task)
> + rescue Exception => e
> + retry if self.tasks.last.action != 'destroy'
> end
> - Taskomatic.destroy_instance(@task)
> - rescue Exception => e
> - retry if self.tasks.last.action != 'destroy'
> end
> end
>
ACK
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.
More information about the aeolus-devel
mailing list