public
Description: Remote multi-server automation tool. This repository is no longer being actively maintained. Please ask on the mailing list to find someone who has a well-maintained fork. Thanks!
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
Don't evaluate role list if hosts are defined.

This prevents Capistrano failing when a task has undefined
roles specified but hosts have been given.

e.g.

task :install_mysql, :roles => :db do
  # install mysql...
end

cap install_mysql HOSTS=some.new.host
mbailey (author)
Sat Aug 23 09:05:59 -0700 2008
commit  8badb0c522b38fae9cbe973451472afbddef61cb
tree    2c41525433a6470fb53b7cb2db7c87ba276d32ab
parent  bd3819766178e18e9287b95586098d2bc804f6df
...
35
36
37
38
39
40
41
 
42
43
44
 
 
 
 
45
46
47
...
35
36
37
 
 
 
 
38
39
40
41
42
43
44
45
46
47
48
0
@@ -35,13 +35,14 @@ module Capistrano
0
       #   servers = find_servers :hosts => "jamis@example.host.com"
0
       def find_servers(options={})
0
         hosts  = server_list_from(ENV['HOSTS'] || options[:hosts])
0
-        roles  = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
0
-        only   = options[:only] || {}
0
-        except = options[:except] || {}
0
-
0
+        
0
         if hosts.any?
0
           hosts.uniq
0
         else
0
+          roles  = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
0
+          only   = options[:only] || {}
0
+          except = options[:except] || {}
0
+          
0
           servers = roles.inject([]) { |list, role| list.concat(self.roles[role]) }
0
           servers = servers.select { |server| only.all? { |key,value| server.options[key] == value } }
0
           servers = servers.reject { |server| except.any? { |key,value| server.options[key] == value } }

Comments