summaryrefslogtreecommitdiff
path: root/lib/oxidized/node.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-03-02 12:36:37 +0200
committerSaku Ytti <saku@ytti.fi>2014-03-02 12:36:37 +0200
commit4baedb0667185fb899ad1c1f5a7782d1228807a9 (patch)
tree180d71eeeb06baaf16163aeee33b8ecd1d2e6b6e /lib/oxidized/node.rb
parent465de586078eb40e6d0ae820d9da8a254c181021 (diff)
Change dynamic loading
If we use assignment method (#method=) we don't get return value, so we never know that manager fails to load. Also we do not want to rescue failures of input/output/source loading, they are catastrophic and should fail whole process, loading of model is not catastrophic.
Diffstat (limited to 'lib/oxidized/node.rb')
-rw-r--r--lib/oxidized/node.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 3027ccd..5a8eb36 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -109,7 +109,7 @@ module Oxidized
inputs = (opt[:input] or CFG.input[:default])
inputs.split(/\s*,\s*/).map do |input|
if not Oxidized.mgr.input[input]
- Oxidized.mgr.input = input or raise MethodNotFound, "#{input} not found"
+ Oxidized.mgr.add_input input or raise MethodNotFound, "#{input} not found for node #{ip}"
end
Oxidized.mgr.input[input]
end
@@ -118,18 +118,17 @@ module Oxidized
def resolve_output opt
output = (opt[:output] or CFG.output[:default])
if not Oxidized.mgr.output[output]
- Oxidized.mgr.output = output or raise MethodNotFound, "#{output} not found"
+ Oxidized.mgr.add_output output or raise MethodNotFound, "#{output} not found for node #{ip}"
end
Oxidized.mgr.output[output]
end
def resolve_model opt
model = (opt[:model] or CFG.model)
- mgr = Oxidized.mgr
- if not mgr.model[model]
- mgr.model = model or raise ModelNotFound, "#{model} not found"
+ if not Oxidized.mgr.model[model]
+ Oxidized.mgr.add_model model or raise ModelNotFound, "#{model} not found for node #{ip}"
end
- mgr.model[model].new
+ Oxidized.mgr.model[model].new
end
end