From 33c12a7615110b44cdfe0617b3cdc586df764193 Mon Sep 17 00:00:00 2001 From: Bas van Elburg Date: Thu, 17 May 2018 20:24:00 +0200 Subject: Fix telnet (#1343) * Fixed: fix debug logging (passed @log to telnet) * Fixed: call closed on sock of telnet instead of telnet --- lib/oxidized/input/telnet.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb index e7c2ee3..4b9a656 100644 --- a/lib/oxidized/input/telnet.rb +++ b/lib/oxidized/input/telnet.rb @@ -16,7 +16,8 @@ module Oxidized telnet_opts = { 'Host' => @node.ip, 'Port' => port.to_i, 'Timeout' => @timeout, - 'Model' => @node.model } + 'Model' => @node.model, + 'Log' => @log } @telnet = Net::Telnet.new telnet_opts if @node.auth[:username] and @node.auth[:username].length > 0 @@ -64,7 +65,7 @@ module Oxidized rescue Errno::ECONNRESET ensure @log.close if Oxidized.config.input.debug? - (@telnet.close rescue true) unless @telnet.closed? + (@telnet.close rescue true) unless @telnet.sock.closed? end end end @@ -80,6 +81,7 @@ class Net::Telnet waittime = @options["Waittime"] fail_eof = @options["FailEOF"] model = @options["Model"] + @log = @options["Log"] if options.kind_of?(Hash) prompt = if options.has_key?("Match") -- cgit v1.2.1