summaryrefslogtreecommitdiff
path: root/lib/oxidized/nodes.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-06-07 22:08:15 +0300
committerSaku Ytti <saku@ytti.fi>2018-06-07 22:08:15 +0300
commita843b5cff1ffa7bba11281402694b992b12a448b (patch)
treeb71abedc753dc4e27725a430a6765a98e9211898 /lib/oxidized/nodes.rb
parent63c5ff8265f9cb4920caf64d53dc655118de02a0 (diff)
Refactor manager, take2
Make all the add_* return falsy valuem and make all the callers raise, this has benefit that the caller has more information, like it can tell what node we were trying to load when model failed to load. We were only failing to do this in two places in the code, source and plugin.
Diffstat (limited to 'lib/oxidized/nodes.rb')
-rw-r--r--lib/oxidized/nodes.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb
index a159b48..3e0869a 100644
--- a/lib/oxidized/nodes.rb
+++ b/lib/oxidized/nodes.rb
@@ -10,7 +10,7 @@ module Oxidized
with_lock do
new = []
@source = Oxidized.config.source.default
- Oxidized.mgr.add_source @source
+ Oxidized.mgr.add_source(@source) or raise(MethodNotFound, "cannot load node source '#{@source}', not found")
Oxidized.logger.info "lib/oxidized/nodes.rb: Loading nodes"
nodes = Oxidized.mgr.source[@source].new.load node_want
nodes.each do |node|