diff options
author | ytti <saku@ytti.fi> | 2016-01-04 18:50:54 +0200 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2016-01-04 18:50:54 +0200 |
commit | 0eeba91b426c8b4a6335a88da9c65ba38e5fac15 (patch) | |
tree | 02ba46c4f7d43b5721f3eb7de38599e0e019e5cf /lib/oxidized/nodes.rb | |
parent | f112dfa0c604ae1c990f6411a002806924c00bf3 (diff) | |
parent | e41f7b429901eb38ad785ad1fc2527dd41f35959 (diff) |
Merge pull request #250 from Shopify/master0.10.0
refactoring, test coverage and github hook
Diffstat (limited to 'lib/oxidized/nodes.rb')
-rw-r--r-- | lib/oxidized/nodes.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index cb2ce7b..0c02d7a 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -1,15 +1,15 @@ module Oxidized - require 'ipaddr' - require 'oxidized/node' - class Oxidized::NotSupported < OxidizedError; end - class Oxidized::NodeNotFound < OxidizedError; end + require 'ipaddr' + require 'oxidized/node' + class Oxidized::NotSupported < OxidizedError; end + class Oxidized::NodeNotFound < OxidizedError; end class Nodes < Array attr_accessor :source alias :put :unshift def load node_want=nil with_lock do new = [] - @source = CFG.source.default + @source = Oxidized.config.source.default Oxidized.mgr.add_source @source Oxidized.mgr.source[@source].new.load.each do |node| # we want to load specific node(s), not all of them @@ -18,13 +18,13 @@ module Oxidized _node = Node.new node new.push _node rescue ModelNotFound => err - Log.error "node %s raised %s with message '%s'" % [node, err.class, err.message] + Oxidized.logger.error "node %s raised %s with message '%s'" % [node, err.class, err.message] rescue Resolv::ResolvError => err - Log.error "node %s is not resolvable, raised %s with message '%s'" % [node, err.class, err.message] + Oxidized.logger.error "node %s is not resolvable, raised %s with message '%s'" % [node, err.class, err.message] end end size == 0 ? replace(new) : update_nodes(new) - Log.info "Loaded #{size} nodes" + Oxidized.logger.info "Loaded #{size} nodes" end end @@ -148,9 +148,9 @@ module Oxidized end end end - + public - + def version node, group with_lock do i = find_node_index node @@ -159,7 +159,7 @@ module Oxidized output.version node, group end end - + def get_version node, group, oid with_lock do i = find_node_index node @@ -168,7 +168,7 @@ module Oxidized output.get_version node, group, oid end end - + def get_diff node, group, oid1, oid2 with_lock do i = find_node_index node |