summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-03-17 11:40:26 +0200
committerSaku Ytti <saku@ytti.fi>2014-03-17 11:40:26 +0200
commitbb2e48ba7e9cc76b987a11952ce7585105911ace (patch)
tree7419487356b4df9a8962e867c39fe3679453b3c8
parent9599347820c75aedda886914cca54cec45f48c63 (diff)
Fix JunOS model
Block must return string, it returned nil which broke it. Also coerce type to string in future, so block won't fail so catastrophically, just output missing.
-rw-r--r--lib/oxidized/model/junos.rb4
-rw-r--r--lib/oxidized/model/model.rb4
-rw-r--r--oxidized.gemspec2
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb
index 4bca998..5b3d11b 100644
--- a/lib/oxidized/model/junos.rb
+++ b/lib/oxidized/model/junos.rb
@@ -20,10 +20,12 @@ class JunOS < Oxidized::Model
end
post do
+ out = ''
case @model
when 'mx960'
- cmd('show chassis fabric reachability') { |cfg| comment cfg }
+ out << cmd('show chassis fabric reachability') { |cfg| comment cfg }
end
+ out
end
cmd 'show chassis hardware' do |cfg|
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index 70b307f..ccc03b4 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -125,10 +125,10 @@ module Oxidized
data << out.to_s
end
procs[:pre].each do |pre_proc|
- pre << instance_eval(&pre_proc)
+ pre << instance_eval(&pre_proc).to_s
end
procs[:post].each do |post_proc|
- data << instance_eval(&post_proc)
+ data << instance_eval(&post_proc).to_s
end
pre + data
end
diff --git a/oxidized.gemspec b/oxidized.gemspec
index ec6d83d..de0a344 100644
--- a/oxidized.gemspec
+++ b/oxidized.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'oxidized'
- s.version = '0.0.39'
+ s.version = '0.0.40'
s.platform = Gem::Platform::RUBY
s.authors = [ 'Saku Ytti' ]
s.email = %w( saku@ytti.fi )