From cf4ab7752cd7c6141f2da0a7491c9f1842c88f09 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Thu, 2 Jun 2016 20:24:18 +0200 Subject: some debug statements --- lib/oxidized/input/cli.rb | 7 ++++++- lib/oxidized/input/ssh.rb | 4 ++-- lib/oxidized/model/model.rb | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'lib') 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..aa44b37 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -54,7 +54,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 +123,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 +131,5 @@ module Oxidized end end end - end end diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb index 9185d43..4a15a45 100644 --- a/lib/oxidized/model/model.rb +++ b/lib/oxidized/model/model.rb @@ -35,6 +35,7 @@ module Oxidized else @cmd[:cmd] << [_cmd, block] end + Oxidized.logger.debug "lib/oxidized/model/model.rb Added #{_cmd} to the commands list" end def cmds @cmd @@ -79,6 +80,7 @@ module Oxidized attr_accessor :input, :node def cmd string, &block + Oxidized.logger.debug "lib/oxidized/model/model.rb Executing #{string}" out = @input.cmd(string) return false unless out self.class.cmds[:all].each do |all_block| @@ -127,6 +129,7 @@ module Oxidized end def get + Oxidized.logger.debug 'lib/oxidized/model/model.rb Collecting commands\' outputs' outputs = Outputs.new procs = self.class.procs self.class.cmds[:cmd].each do |command, block| -- cgit v1.2.1