[PATCH conductor 2/2] BZ 786844 - Fix logic flaw in destroy_on_provider
Matt Wagner
matt.wagner at redhat.com
Mon Feb 13 19:19:17 UTC 2012
(foo != "x" or foo != "y") will always return true. While fixing,
I also cleaned up the syntax to make it less prone to such errors,
and skipped deletion if we were in STATE_VANISHED.
---
src/app/models/instance.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 1ef0794..a7a82b5 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -457,8 +457,8 @@ class Instance < ActiveRecord::Base
]
def destroy_on_provider
- if provider_account and (provider_account.provider.provider_type.deltacloud_driver != "ec2" or
- provider_account.provider.provider_type.deltacloud_driver != "mock") and state != STATE_CREATE_FAILED
+ if provider_account and !['ec2', 'mock'].include?(provider_account.provider.provider_type.deltacloud_driver) and
+ ![STATE_CREATE_FAILED, STATE_VANISHED].include?(state)
retries = 0
begin
retries += 1
--
1.7.6.5
More information about the aeolus-devel
mailing list