diff options
author | Brian Candler <b.candler@pobox.com> | 2018-06-25 12:19:49 +0100 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2018-06-25 14:19:49 +0300 |
commit | bde8ed8faffcfb155ec32b76c93485d311bc339c (patch) | |
tree | b4b053ec1190074bc9dddde295c874788fee3890 /lib/oxidized/model | |
parent | 6e09d20d9c519b6bed28a8dc9c40fb4da851fa76 (diff) |
Tidy up logic for sending 'enable' with or without password (#1418)
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r-- | lib/oxidized/model/netgear.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb index 951af1c..67675ad 100644 --- a/lib/oxidized/model/netgear.rb +++ b/lib/oxidized/model/netgear.rb @@ -14,15 +14,12 @@ class Netgear < Oxidized::Model end cfg :telnet, :ssh do - if vars :enable - post_login do - 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?$/ - send vars(:enable) + "\n" - end - expect /^.+[#]$/ + post_login do + if vars(:enable) == true + cmd "enable" + elsif vars(:enable) + cmd "enable", /[pP]assword:\s?$/ + cmd vars(:enable) end end post_login 'terminal length 0' |