summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2016-10-31 17:54:47 +0200
committerSaku Ytti <saku@ytti.fi>2016-10-31 17:54:47 +0200
commit98ee2d2fadd56b9efadfc4f9ff667f71f6b22f6c (patch)
treef29af7273b01e8338c55a0d291bd644b97cf05f5
parent0c307da5dfd5c7fa4dfa156694c619ab3b3fa0d3 (diff)
Allow model to specify SSH PTY options
-rw-r--r--lib/oxidized/input/ssh.rb11
-rw-r--r--lib/oxidized/model/procurve.rb4
2 files changed, 12 insertions, 3 deletions
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