Skip to content
Browse files

Forcing ssh_wait is considered harmful.

1. If your Blimpfile is misconfigured, you'll not get any diagnostics information.
2. When you press Ctrl+C, blimpy doesn't exit because it's just ssh getting killed (and blimp ignores that)

There appears to be no provision for handling options, so I just made it a separate command
  • Loading branch information...
1 parent 9eb01a5 commit 8b3800894c283cf34b8598731592770e22ebd984 @kohsuke kohsuke committed Dec 19, 2012
Showing with 26 additions and 2 deletions.
  1. +2 −0 lib/blimpy/box.rb
  2. +24 −2 lib/blimpy/cli.rb
View
2 lib/blimpy/box.rb
@@ -236,6 +236,8 @@ def wait_for_sshd
until @ssh_connected
# Run the `true` command and exit
@ssh_connected = ssh_into('-q', 'true')
+ # if SSH is killed (such as Ctrl+C), abort right away
+ raise Blimpy::Exception, "ssh was killed: #@ssh_connected" if $?.exitstatus>128
unless @ssh_connected
if (Time.now.to_i - start) < 60
View
26 lib/blimpy/cli.rb
@@ -142,10 +142,33 @@ def ssh(name=nil, *args)
end
end
- box.wait_for_sshd
box.ssh_into
end
+ desc 'wait_for_ssh', 'Wait for SSHD to come online'
+ def wait_for_ssh(name=nil, *args)
+ unless name.nil?
+ box = box_by_name(name)
+ if box.nil?
+ puts "Could not find a blimp named \"#{name}\""
+ exit 1
+ end
+ else
+ blimps = current_blimps
+ unless blimps
+ puts "No Blimps running!"
+ exit 1
+ end
+
+ blimps.each do |blimp, data|
+ next unless data[:name]
+ box = box_by_name(data[:name])
+ end
+ end
+
+ box.wait_for_sshd
+ end
+
desc 'scp BLIMP_NAME FILE_NAME', 'Securely copy FILE_NAME into the blimp'
def scp(name, filename, *args)
ensure_blimpfile
@@ -154,7 +177,6 @@ def scp(name, filename, *args)
puts "Could not find a blimp named \"#{name}\""
exit 1
end
- box.wait_for_sshd
# Pass any extra commands along to the `scp` invocation
box.scp_file(filename, '', *ARGV[3..-1])
end

0 comments on commit 8b38008

Please sign in to comment.
Something went wrong with that request. Please try again.