class Dopi::Command::Ssh::Reboot
Public Instance Methods
reboot_cmd()
click to toggle source
# File lib/dopi/command/ssh/reboot.rb, line 35 def reboot_cmd @reboot_cmd ||= reboot_cmd_valid? ? hash[:reboot_cmd] : 'shutdown -r now' end
run()
click to toggle source
Calls superclass method
Dopi::Command::Ssh::WaitForLogin#run
# File lib/dopi/command/ssh/reboot.rb, line 15 def run ssh_command({}, reboot_cmd) connected = true @connection_timeout = 1 while connected begin connected = check_exit_code(ssh_command({}, 'exit')[2]) rescue Dopi::NodeConnectionError, Dopi::CommandConnectionError connected = false end if connected sleep 1 raise GracefulExit if signals[:stop] log(:info, "Still able to login, waiting for shutdown") end end log(:info, "Node is down, starting to check for login") @connection_timeout = nil super end
validate()
click to toggle source
Calls superclass method
Dopi::Command::Ssh::WaitForLogin#validate
# File lib/dopi/command/ssh/reboot.rb, line 10 def validate super log_validation_method(:reboot_cmd_valid?, CommandParsingError) end
Private Instance Methods
reboot_cmd_valid?()
click to toggle source
# File lib/dopi/command/ssh/reboot.rb, line 41 def reboot_cmd_valid? return false if hash[:reboot_cmd].nil? # is optional hash[:reboot_cmd].class == String or raise CommandParsingError, "Plugin #{name}: the value of 'reboot_cmd' has to be a string" end