summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. Brandt Buckley <brandt@runlevel1.com>2015-03-07 21:43:02 -0800
committerJ. Brandt Buckley <brandt@runlevel1.com>2015-03-07 21:43:02 -0800
commitc17d8d48e44fd3277554e03469183fd20f2eefc7 (patch)
treeedf1028a385a4d5fe2395f1f056270b6bccfe4d4
parentcb851fdc9bfdeae603f8c56fe5bc69838b01f420 (diff)
Add back ability to use passwordless enable on EOS
This commit adds the ability to go into Privileged EXEC mode when no password is required by setting `enable: true`. By default, in Arista EOS you aren't prompted for a password when entering Privileged EXEC (or privilege mode 15) mode. In PR #86, oxidized began always expecting a password. An unquoted `true` in YAML is a boolean. So when `var(:enabled)` is `TrueClass`, we interpret this as meaning that the user wishes to go into Privileged EXEC mode and does not require a password.
-rw-r--r--lib/oxidized/model/eos.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/oxidized/model/eos.rb b/lib/oxidized/model/eos.rb
index 98a8c28..c1bc23a 100644
--- a/lib/oxidized/model/eos.rb
+++ b/lib/oxidized/model/eos.rb
@@ -28,8 +28,11 @@ class EOS < Oxidized::Model
if vars :enable
post_login do
send "enable\n"
- expect /[pP]assword:\s?$/
- send vars(: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 /^.+[#>]\s?$/
end
post_login 'terminal length 0'
@@ -38,4 +41,3 @@ class EOS < Oxidized::Model
end
end
-