From 98ee2d2fadd56b9efadfc4f9ff667f71f6b22f6c Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Mon, 31 Oct 2016 17:54:47 +0200 Subject: Allow model to specify SSH PTY options --- lib/oxidized/input/ssh.rb | 11 ++++++++--- lib/oxidized/model/procurve.rb | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 15f1427..30b481d 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -17,8 +17,9 @@ module Oxidized class NoShell < OxidizedError; end def connect node - @node = node - @output = '' + @node = node + @output = '' + @pty_options = { term: "vt100" } @node.model.cfg['ssh'].each { |cb| instance_exec(&cb) } secure = Oxidized.config.input.ssh.secure @log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug? @@ -74,6 +75,10 @@ module Oxidized private + def pty_options hash + @pty_options = @pty_options.merge hash + end + def disconnect disconnect_cli # if disconnect does not disconnect us, give up after timeout @@ -94,7 +99,7 @@ module Oxidized @output << data @output = @node.model.expects @output end - ch.request_pty (_opts={:term=>'vt100'}) do |_ch, success_pty| + ch.request_pty (@pty_options) do |_ch, success_pty| raise NoShell, "Can't get PTY" unless success_pty ch.send_channel_request 'shell' do |_ch, success_shell| raise NoShell, "Can't get shell" unless success_shell diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index da792e6..c117df3 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -57,4 +57,8 @@ class Procurve < Oxidized::Model pre_logout "logout\ny\nn" end + cfg :ssh do + pty_options({ chars_wide: 1000 }) + end + end -- cgit v1.2.1