From 55602de1caa49016a2b54a34424e08c37ab2f398 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Wed, 27 Jun 2018 19:50:59 +0300 Subject: Don't use SSH logger unless input debug is set --- lib/oxidized/input/ssh.rb | 7 +++++-- spec/input/ssh_spec.rb | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index d97633d..8caa801 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -123,7 +123,6 @@ module Oxidized port: (vars(:ssh_port) || 22).to_i, paranoid: secure, keepalive: true, - logger: Oxidized.logger, password: @node.auth[:password], timeout: Oxidized.config.timeout, number_of_password_prompts: 0 @@ -144,7 +143,11 @@ module Oxidized ssh_opts[:keys] = [vars(:ssh_keys)].flatten if vars(:ssh_keys) ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex) ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption) - ssh_opts[:verbose] = Logger::DEBUG if Oxidized.config.input.debug? + + if Oxidized.config.input.debug? + ssh_opts[:logger] = Oxidized.logger + ssh_opts[:verbose] = Logger::DEBUG + end ssh_opts end diff --git a/spec/input/ssh_spec.rb b/spec/input/ssh_spec.rb index f9704d4..9864373 100644 --- a/spec/input/ssh_spec.rb +++ b/spec/input/ssh_spec.rb @@ -34,7 +34,6 @@ describe Oxidized::SSH do Net::SSH.expects(:start).with('93.184.216.34', 'alma', port: 22, paranoid: Oxidized.config.input.ssh.secure, keepalive: true, - logger: Oxidized.logger, password: 'armud', timeout: Oxidized.config.timeout, number_of_password_prompts: 0, @@ -66,7 +65,6 @@ describe Oxidized::SSH do Net::SSH.expects(:start).with('example.com', 'alma', port: 22, paranoid: Oxidized.config.input.ssh.secure, keepalive: true, - logger: Oxidized.logger, password: 'armud', timeout: Oxidized.config.timeout, number_of_password_prompts: 0, -- cgit v1.2.1