summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamer Abdel-Hafez <sam@arahant.net>2015-03-06 12:07:50 +0100
committerSamer Abdel-Hafez <sam@arahant.net>2015-03-06 12:07:56 +0100
commitcb851fdc9bfdeae603f8c56fe5bc69838b01f420 (patch)
tree7fb241645347e45d096d230816c2cd341df4544d
parent100c4480aa2f1e6e16e47ac6c1bd85429e2ab6a0 (diff)
Log prompt detection failures
-rw-r--r--CHANGELOG.md3
-rw-r--r--lib/oxidized/input/input.rb2
-rw-r--r--lib/oxidized/input/ssh.rb6
-rw-r--r--lib/oxidized/input/telnet.rb6
4 files changed, 15 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1481a0b..7ce9640 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,13 @@
- FEATURE: unconditionally start new job if too long has passed since previous start
- FEATURE: add enable to Arista EOS model
- FEATURE: add rugged dependency in gemspec
+- FEATURE: log prompt detection failures
- BUGFIX: xos while using telnet (by @fhibler)
- BUGFIX: ironware logout on some models (by @fhibler)
- BUGFIX: allow node to be removed while it is being collected
- BUGFIX: if model returns non string value, return empty string
+- BUGFIX: better prompt for Arista EOS model (by @rodecker)
+- BUGFIX: improved configuration handling for Arista EOS model (by @rodecker)
# 0.3.0
- FEATURE: *FIXME* bunch of stuff I did for richih, docs needed
diff --git a/lib/oxidized/input/input.rb b/lib/oxidized/input/input.rb
index a7fb16d..da8ff5d 100644
--- a/lib/oxidized/input/input.rb
+++ b/lib/oxidized/input/input.rb
@@ -1,4 +1,5 @@
module Oxidized
+ class PromptUndetect < OxidizedError; end
class Input
include Oxidized::Config::Vars
@@ -8,6 +9,7 @@ module Oxidized
],
:warn => [
IOError,
+ PromptUndetect,
Timeout::Error,
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index 62a31eb..ec33d37 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -26,7 +26,11 @@ module Oxidized
:paranoid => secure
unless @exec
shell_open @ssh
- @username ? shell_login : expect(@node.prompt)
+ begin
+ @username ? shell_login : expect(@node.prompt)
+ rescue Timeout::Error
+ raise PromptUndetect, [ @output, 'not matching configured prompt', @node.prompt ].join(' ')
+ end
end
connected?
end
diff --git a/lib/oxidized/input/telnet.rb b/lib/oxidized/input/telnet.rb
index 62f361e..13fccf7 100644
--- a/lib/oxidized/input/telnet.rb
+++ b/lib/oxidized/input/telnet.rb
@@ -20,7 +20,11 @@ module Oxidized
@telnet.puts @node.auth[:username]
expect password
@telnet.puts @node.auth[:password]
- expect @node.prompt
+ begin
+ expect @node.prompt
+ rescue Timeout::Error
+ raise PromptUndetect, [ 'unable to detect prompt:', @node.prompt ].join(' ')
+ end
end
def connected?