From: Tomas Sedovic <tomas(a)sedovic.cz>
---
src/app/models/deployment.rb | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index ec66fdb..cb37aba 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -246,8 +246,15 @@ class Deployment < ActiveRecord::Base
status[:errors][name] = errors
return status
end
+
+ valid_accounts, invalid_accounts = account_matches.keys.partition {|acc|
acc.connect}
+ if valid_accounts.empty?
+ status[:errors][name] = invalid_accounts.map {|acc| acc.errors[:provider]}.flatten
+ return status
+ end
+
# grab the account with the best priority that can launch this deployment
- account = account_matches.keys.sort do |a,b|
+ account = valid_accounts.sort do |a,b|
if a.priority.nil? and b.priority.nil?
0
elsif a.priority.nil?
--
1.7.6.5