On Nov 3, 2006, at 12:12 PM, Jamis Buck wrote:

>
> On Nov 3, 2006, at 1:10 PM, Jamis Buck wrote:
>
>> Ezra,
>>
>> Capistrano is currently extremely opinionated on this point. There  
>> is setting anywhere you can tweak to make Capistrano use different  
>> SSH
>
> Gah. That should be "There is NO setting anywhere..."
>
> - Jamis
>

Hey Jamis-

        I was able to come up with a 3 line patch that allows for multiple  
ports. All current tests still pass and backwards compatibility is  
completely retained. This patch allows for this syntax for defining  
roles as well as the old syntax and you can intermix the two and  
still use ssh_options[:port].

role :web, "65.74.169.199"
role :app, "65.74.169.199:8029", "65.74.169.199:8030",  
"65.74.169.199:8031", "65.74.169.199:32"
role :prod_slave,  "65.74.169.199:8030"
role :db,  "65.74.169.199", :primary => true

ssh_options[:port] = 8888

ssh_options[:port] will be over-ridden for any host that has  :PORT  
as part of the string. And any IP's or hostnames that do not  
have :PORT in them will use the ssh_options[:port] num or 22 if this  
is not set.
        

        Does this seem like an exceptable patch Jamis? I am happy to make it  
a capistrano extension if you don't think it belongs in core cap. But  
using "hostname.com:7555"  seems like something that should "just  
work" with cap so I would love to see this make it in.

        Should I submit this to the rails track as a [PATCH] ticket?

        Thanks you so much for capistrano. It makes my life a lot easier  
maintaining hundreds of Xen instances ;)


ez capistrano $ svn diff
Index: lib/capistrano/ssh.rb
===================================================================
--- lib/capistrano/ssh.rb       (revision 5430)
+++ lib/capistrano/ssh.rb       (working copy)
@@ -27,7 +27,9 @@
                          :password => password_value,
                          :port => port,
                          :auth_methods => methods.shift }.merge 
(config.ssh_options)
-        Net::SSH.start(server,ssh_options,&block)
+        Net::SSH.start((server.gsub(/:(\d+)$/,'') || server),
+                       ($1 ? ssh_options.merge({:port=>$1}) :  
ssh_options),
+                       &block)
        rescue Net::SSH::AuthenticationFailed
          raise if methods.empty?
          password_value = config.password


ez capistrano $ rake test
(in /Users/ez/_engine_yard/capistrano)
/usr//bin/ruby -Ilib -rubygems "/usr//lib/ruby/gems/1.8/gems/ 
rake-0.7.1/lib/rake/rake_test_loader.rb" "test/actor_test.rb" "test/ 
command_test.rb" "test/configuration_test.rb" "test/ssh_test.rb"  
"test/scm/cvs_test.rb" "test/scm/subversion_test.rb"
Loaded suite /usr//lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/ 
rake_test_loader
Started
........................................................................ 
............
Finished in 0.027193 seconds.

84 tests, 161 assertions, 0 failures, 0 errors


Cheers-

-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- [EMAIL PROTECTED]
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)




--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to