lib/shuttle/runner.rb in shuttle-deploy-0.2.3 vs lib/shuttle/runner.rb in shuttle-deploy-0.3.0.beta1
- old
+ new
@@ -1,5 +1,7 @@
+require "timeout"
+
module Shuttle
class Runner
attr_reader :options
attr_reader :config_path
attr_reader :config, :target
@@ -80,11 +82,16 @@
if options[:log]
ssh.logger = Logger.new(STDOUT)
end
- ssh.open
-
+ begin
+ Timeout::timeout(10) { ssh.open }
+ rescue Timeout::Error
+ STDERR.puts "Unable to establish SSH connection to the server within 10 seconds"
+ exit 1
+ end
+
klass = Shuttle.const_get(strategy.capitalize) rescue nil
command.gsub!(/:/,'_')
exit_code = 0
if klass.nil?
\ No newline at end of file