Class: Dopi::Command::Ssh::WaitForLogin
- Inherits:
-
Dopi::Command
- Object
- Dopi::Command
- Dopi::Command::Ssh::WaitForLogin
- Defined in:
- lib/dopi/command/ssh/wait_for_login.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_CONNECTION_TIMEOUT =
0
- DEFAULT_INTERVAL =
10
Instance Attribute Summary
Attributes inherited from Dopi::Command
#hash, #is_verify_command, #node
Instance Method Summary collapse
- #connection_timeout ⇒ Object
- #interval ⇒ Object
- #run ⇒ Object
- #ssh_options_defaults ⇒ Object
- #validate ⇒ Object
Methods included from Dopi::CommandParser::ExitCode
#check_exit_code, #expect_exit_codes, #validate_exit_code
Methods included from Dopi::Connector::Ssh
#base64, #check_host_key, #port, #quiet, #ssh_command, #ssh_options, #supported_credential_types, #validate_ssh
Methods included from Dopi::CommandParser::Credentials
#credentials, #validate_credentials
Methods included from Dopi::Connector::Local
Methods inherited from Dopi::Command
create_plugin_instance, delete_plugin_default, delete_plugin_defaults, inherited, #initialize, #load_state, #merged_hash, #meta_run, #meta_valid?, plugin_defaults, set_plugin_defaults, #state_hash, wipe_plugin_defaults
Methods included from State
#delete_on_signal, #on_signal, #reset_signals, #send_signal, #signal_procs, #signals, #state, #state_add_child, #state_auto_evaluate_children, #state_auto_evaluate_children=, #state_changed, #state_children, #state_children_done?, #state_children_failed?, #state_children_partial?, #state_children_ready?, #state_children_running?, #state_children_running_noop?, #state_children_starting?, #state_done?, #state_fail, #state_failed?, #state_finish, #state_partial?, #state_ready, #state_ready?, #state_reset, #state_reset_with_children, #state_run, #state_run_noop, #state_running?, #state_running_noop?, #state_start, #state_starting?, #to_yaml_properties, #update, #update_mutex
Constructor Details
This class inherits a constructor from Dopi::Command
Instance Method Details
#connection_timeout ⇒ Object
37 38 39 40 |
# 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 ⇒ Object
42 43 44 45 |
# File 'lib/dopi/command/ssh/wait_for_login.rb', line 42 def interval @interval ||= interval_valid? ? hash[:interval] : DEFAULT_INTERVAL end |
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 ⇒ Object
47 48 49 |
# File 'lib/dopi/command/ssh/wait_for_login.rb', line 47 def [" -o ConnectTimeout=#{connection_timeout} -q "] end |
#validate ⇒ Object
15 16 17 18 19 20 |
# 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 |