[PATCH conductor 4/4] BZ#773768 Validate account connectivity on launching deployments

tsedovic at redhat.com tsedovic at redhat.com
Tue Feb 28 17:26:47 UTC 2012


From: Tomas Sedovic <tomas at 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




More information about the aeolus-devel mailing list