public
Description: Remote multi-server automation tool
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
work around net::ssh's lazy requiring of files


git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@7009 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jamis (author)
Tue Jun 12 13:29:00 -0700 2007
commit  3000231c93b0b19ade493170fc4b3f5fd06e337a
tree    fd268877761feaf064086b089bb556d976b63d08
parent  40cbba7e8518ad1cc936642d495a62d8cd07b177
...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
74
75
76
...
56
57
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
60
61
62
63
0
@@ -56,21 +56,8 @@ module Capistrano
0
 
0
       # Ensures that there are active sessions for each server in the list.
0
       def establish_connections_to(servers)
0
- servers = Array(servers)
0
-
0
- # because Net::SSH uses lazy loading for things, we need to make sure
0
- # that at least one connection has been made successfully, to kind of
0
- # "prime the pump", before we go gung-ho and do mass connection in
0
- # parallel. Otherwise, the threads start doing things in wierd orders
0
- # and causing Net::SSH to die of confusion.
0
- # TODO investigate Net::SSH and see if this can't be solved there
0
-
0
- if sessions.empty?
0
- server, servers = servers.first, servers[1..-1]
0
- sessions[server] = connection_factory.connect_to(server)
0
- end
0
-
0
- servers.map { |server| establish_connection_to(server) }.each { |t| t.join }
0
+ threads = Array(servers).map { |server| establish_connection_to(server) }
0
+ threads.each { |t| t.join }
0
       end
0
 
0
       # Determines the set of servers within the current task's scope and
...
10
11
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
14
15
...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -10,6 +10,29 @@ module Capistrano
0
     end
0
   end
0
 
0
+ # Now, Net::SSH is kind of silly, and tries to lazy-load everything. This
0
+ # wreaks havoc with the parallel connection trick that Capistrano wants to
0
+ # use, so we're going to do something hideously ugly here and force all the
0
+ # files that Net::SSH uses to load RIGHT NOW, rather than lazily.
0
+
0
+ net_ssh_dependencies = %w(connection/services connection/channel connection/driver
0
+ service/agentforward/services service/agentforward/driver
0
+ service/forward/services service/forward/driver service/forward/local-network-handler service/forward/remote-network-handler
0
+ lenient-host-key-verifier
0
+ transport/compress/services transport/compress/zlib-compressor transport/compress/none-compressor transport/compress/zlib-decompressor transport/compress/none-decompressor
0
+ transport/kex/services transport/kex/dh transport/kex/dh-gex
0
+ transport/ossl/services
0
+ transport/ossl/hmac/services transport/ossl/hmac/sha1 transport/ossl/hmac/sha1-96 transport/ossl/hmac/md5 transport/ossl/hmac/md5-96 transport/ossl/hmac/none
0
+ transport/ossl/cipher-factory transport/ossl/hmac-factory transport/ossl/buffer-factory transport/ossl/key-factory transport/ossl/digest-factory
0
+ transport/identity-cipher transport/packet-stream transport/version-negotiator transport/algorithm-negotiator transport/session
0
+ userauth/methods/services userauth/methods/password userauth/methods/keyboard-interactive userauth/methods/publickey userauth/methods/hostbased
0
+ userauth/services userauth/agent userauth/userkeys userauth/driver
0
+ transport/services
0
+ )
0
+
0
+ net_ssh_dependencies << "userauth/pageant" if File::ALT_SEPARATOR
0
+ net_ssh_dependencies.each { |path| require "net/ssh/#{path}" }
0
+
0
   # A helper class for dealing with SSH connections.
0
   class SSH
0
     # Patch an accessor onto an SSH connection so that we can record the server

Comments

    No one has commented yet.