class Dopi::Command::Ssh::WaitForLogin
Constants
- DEFAULT_CONNECTION_TIMEOUT
- DEFAULT_INTERVAL
Public Instance Methods
connection_timeout()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 37 def connection_timeout @connection_timeout ||= connection_timeout_valid? ? hash[:connection_timeout] : DEFAULT_CONNECTION_TIMEOUT end
interval()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 42 def interval @interval ||= interval_valid? ? hash[:interval] : DEFAULT_INTERVAL end
run()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 22 def run connected = false until connected begin connected = check_exit_code(ssh_command({}, 'exit')[2]) rescue Dopi::NodeConnectionError, Dopi::CommandConnectionError end unless connected sleep interval raise GracefulExit if signals[:stop] log(:info, "Retrying connect to node") end end true end
ssh_options_defaults()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 47 def ssh_options_defaults [" -o ConnectTimeout=#{connection_timeout} -q "] end
validate()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 15 def validate validate_ssh validate_exit_code log_validation_method(:connection_timeout_valid?, CommandParsingError) log_validation_method(:interval_valid?, CommandParsingError) end
Private Instance Methods
connection_timeout_valid?()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 53 def connection_timeout_valid? return false if hash[:connection_timeout].nil? # is optional hash[:connection_timeout].class == Fixnum or raise CommandParsingError, "Plugin #{name}: the value of 'connection_timeout' has to be a number" end
interval_valid?()
click to toggle source
# File lib/dopi/command/ssh/wait_for_login.rb, line 59 def interval_valid? return false if hash[:interval].nil? # is optional hash[:interval].class == Fixnum or raise CommandParsingError, "Plugin #{name}: the value of 'interval' has to be a number" end