[PATCH conductor] Quick Fix, destroy method is not called for ec2 and Mock instances, or if instance is in CREATE_FAILED state
Michal Fojtik
mfojtik at redhat.com
Tue Dec 13 16:00:40 UTC 2011
On Dec 13, 2011, at 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
I would like to ask why the 'label' us used to determine which provider us currently used.
I though that the provider.label is customizable, so the user can use something like 'amazon'
instead of EC2. In that case this code will never work.
> + begin
> + @task = self.queue_action(self.owner, 'destroy')
> + unless @task
> + raise ActionError.new("destroy cannot be performed on this instance."
This error message does not need to be localized?
> + 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
>
> --
> 1.7.7.4
>
------------------------------------------------------
Michal Fojtik, mfojtik at redhat.com
Deltacloud API: http://deltacloud.org
More information about the aeolus-devel
mailing list