On Friday, October 07, 2011 02:06:18 PM Tomas Hrcka wrote:
---
src/app/models/deployment.rb | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/app/models/deployment.rb
b/src/app/models/deployment.rb
index 2edd65e..0fb8e7c 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -305,11 +305,15 @@ class Deployment < ActiveRecord::Base
end
def deployment_state
- return instances.first.state if not instances.empty? and
instances.length == 1 - oracle = instances.first.state
- instances.each do |i|
- return STATE_MIXED if i.state != oracle
+ unless instances.empty?
+ return instances.first.state if not instances.empty? and
instances.length == 1 + oracle = instances.first.state
+ instances.each do |i|
+ return STATE_MIXED if i.state != oracle
+ end
+ return oracle
+ else
+ return
end
- return oracle
end
end
ACK
but there is no specification of what to return when there is no
instances
--
Petr Blaho