diff options
author | Brian Candler <b.candler@pobox.com> | 2017-07-06 21:00:19 +0100 |
---|---|---|
committer | Brian Candler <b.candler@pobox.com> | 2017-07-06 21:00:19 +0100 |
commit | 54302e0242437601de3aba3f13ec47e160f2917f (patch) | |
tree | 284de498bc08eeb23e668afdf95e303405d6ddb4 | |
parent | 7974cdbcf59d21a28271a6d472b2a0e8ee5bf4ff (diff) |
Fixes for Netgear
- match the User: prompt on telnet
- fix the sending of enable password
- don't issue exit/quit commands on logout, because an
additional prompt may or may not be encountered
Closes #920
-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| |