diff options
Diffstat (limited to 'lib/oxidized/input')
-rw-r--r-- | lib/oxidized/input/cli.rb | 7 | ||||
-rw-r--r-- | lib/oxidized/input/ssh.rb | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/oxidized/input/cli.rb b/lib/oxidized/input/cli.rb index 731b459..fc7f426 100644 --- a/lib/oxidized/input/cli.rb +++ b/lib/oxidized/input/cli.rb @@ -17,10 +17,15 @@ module Oxidized end def connect_cli - @post_login.each { |command, block| block ? block.call : (cmd command) } + Oxidized.logger.debug "lib/oxidized/input/cli.rb: Running post_login commands at #{node.name}" + @post_login.each do |command, block| + Oxidized.logger.debug "lib/oxidized/input/cli.rb: Running post_login command: #{command.inspect}, block: #{block.inspect} at #{node.name}" + block ? block.call : (cmd command) + end end def disconnect_cli + Oxidized.logger.debug "lib/oxidized/input/cli.rb Running pre_logout commands at #{node.name}" @pre_logout.each { |command, block| block ? block.call : (cmd command, nil) } end diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index fef20d6..db39a7e 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -37,6 +37,7 @@ module Oxidized ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex) ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption) + Oxidized.logger.debug "lib/oxidized/input/ssh.rb: Connecting to #{@node.name}" @ssh = Net::SSH.start(@node.ip, @node.auth[:username], ssh_opts) unless @exec shell_open @ssh @@ -54,7 +55,7 @@ module Oxidized end def cmd cmd, expect=node.prompt - Oxidized.logger.debug "SSH: #{cmd} @ #{node.name}" + Oxidized.logger.debug "lib/oxidized/input/ssh.rb #{cmd} @ #{node.name} with expect: #{expect.inspect}" if @exec @ssh.exec! cmd else @@ -123,6 +124,7 @@ module Oxidized end def expect regexp + Oxidized.logger.debug "lib/oxidized/input/ssh.rb: expecting #{regexp.inspect} at #{node.name}" Timeout::timeout(Oxidized.config.timeout) do @ssh.loop(0.1) do sleep 0.1 @@ -130,6 +132,5 @@ module Oxidized end end end - end end |