diff options
author | ytti <saku@ytti.fi> | 2017-07-07 13:45:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 13:45:00 +0300 |
commit | b20baaf3fff88c48dabe0d471e18d50bfbade539 (patch) | |
tree | 284de498bc08eeb23e668afdf95e303405d6ddb4 /lib/oxidized/model/netgear.rb | |
parent | 7974cdbcf59d21a28271a6d472b2a0e8ee5bf4ff (diff) | |
parent | 54302e0242437601de3aba3f13ec47e160f2917f (diff) |
Merge pull request #923 from candlerb/candlerb/920
Fixes for Netgear
Diffstat (limited to 'lib/oxidized/model/netgear.rb')
-rw-r--r-- | lib/oxidized/model/netgear.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb index 08c64d3..38aaca7 100644 --- a/lib/oxidized/model/netgear.rb +++ b/lib/oxidized/model/netgear.rb @@ -8,21 +8,29 @@ class Netgear < Oxidized::Model cfg end + cfg :telnet do + username /^User:/ + end + cfg :telnet, :ssh do if vars :enable post_login do - cmd 'enable' + send "enable\n" # Interpret enable: true as meaning we won't be prompted for a password unless vars(:enable).is_a? TrueClass expect /[pP]assword:\s?$/ - cmd vars(:enable) + "\n" + send vars(:enable) + "\n" end expect /^.+[#]$/ end end post_login 'terminal length 0' - pre_logout 'exit' - pre_logout 'quit' + # quit / logout will sometimes prompt the user: + # + # The system has unsaved changes. + # Would you like to save them now? (y/n) + # + # So it is safer simply to disconnect and not issue a pre_logout command end cmd 'show running-config' do |cfg| |