diff options
author | Saku Ytti <saku@ytti.fi> | 2014-03-02 12:36:37 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-03-02 12:36:37 +0200 |
commit | 4baedb0667185fb899ad1c1f5a7782d1228807a9 (patch) | |
tree | 180d71eeeb06baaf16163aeee33b8ecd1d2e6b6e /lib/oxidized/nodes.rb | |
parent | 465de586078eb40e6d0ae820d9da8a254c181021 (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/nodes.rb')
-rw-r--r-- | lib/oxidized/nodes.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index 9a3d3bd..0d9fb47 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -9,14 +9,14 @@ module Oxidized with_lock do new = [] @source = CFG.source[:default] - Oxidized.mgr.source = @source + Oxidized.mgr.add_source @source Oxidized.mgr.source[@source].new.load.each do |node| begin - n = Node.new node - rescue LoadError => err - Log.warn 'load error %s with node %s' % [err.message, node] + _node = Node.new node + new.push _node + rescue ModelNotFound => err + Log.error "node %s raised %s with message %s" % [node, err.class, err.message] end - new.push n if n end replace new end |