diff options
author | Wild Kat <wk@futureinquestion.net> | 2018-04-27 12:37:26 +0200 |
---|---|---|
committer | Wild Kat <wk@futureinquestion.net> | 2018-04-27 12:37:26 +0200 |
commit | 8f1ac4ad5503ac4a59d41ebc3f142c1d5d097bfb (patch) | |
tree | 8860b268793dd783b9b5cd5d1a255fe1edebfb0e /lib/oxidized/node.rb | |
parent | cd92bac4a582eb8e19d9d036455591c9684eae72 (diff) | |
parent | 34fd5369feee94ab45c5a81d7769b1df717e4c8c (diff) |
Merge remote-tracking branch 'upstream/master' into pr-1280
Diffstat (limited to 'lib/oxidized/node.rb')
-rw-r--r-- | lib/oxidized/node.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 2b15d4e..27bd9a5 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -39,7 +39,7 @@ module Oxidized cfg_name = input.to_s.split('::').last.downcase next unless @model.cfg[cfg_name] and not @model.cfg[cfg_name].empty? @model.input = input = input.new - if config=run_input(input) + if config = run_input(input) Oxidized.logger.debug "lib/oxidized/node.rb: #{input.class.name} ran for #{name} successfully" status = :success break @@ -55,7 +55,7 @@ module Oxidized def run_input input rescue_fail = {} [input.class::RescueFail, input.class.superclass::RescueFail].each do |hash| - hash.each do |level,errors| + hash.each do |level, errors| errors.each do |err| rescue_fail[err] = level end @@ -64,9 +64,9 @@ module Oxidized begin input.connect(self) and input.get rescue *rescue_fail.keys => err - resc = '' + resc = '' if not level = rescue_fail[err.class] - resc = err.class.ancestors.find{|e|rescue_fail.keys.include? e} + resc = err.class.ancestors.find { |e| rescue_fail.keys.include? e } level = rescue_fail[resc] resc = " (rescued #{resc})" end @@ -196,20 +196,20 @@ module Oxidized end end - def resolve_key key, opt, global=nil + def resolve_key key, opt, global = nil # resolve key, first get global, then get group then get node config key_sym = key.to_sym key_str = key.to_s value = global Oxidized.logger.debug "node.rb: resolving node key '#{key}', with passed global value of '#{value}' and node value '#{opt[key_sym]}'" - #global + # global if not value and Oxidized.config.has_key?(key_str) value = Oxidized.config[key_str] Oxidized.logger.debug "node.rb: setting node key '#{key}' to value '#{value}' from global" end - #group + # group if Oxidized.config.groups.has_key?(@group) if Oxidized.config.groups[@group].has_key?(key_str) value = Oxidized.config.groups[@group][key_str] @@ -217,7 +217,7 @@ module Oxidized end end - #model + # model # FIXME: warning: instance variable @model not initialized if Oxidized.config.models.has_key?(@model.class.name.to_s.downcase) if Oxidized.config.models[@model.class.name.to_s.downcase].has_key?(key_str) @@ -226,7 +226,7 @@ module Oxidized end end - #node + # node value = opt[key_sym] || value Oxidized.logger.debug "node.rb: returning node key '#{key}' with value '#{value}'" value @@ -239,6 +239,5 @@ module Oxidized def is_gitcrypt? opt (opt[:output] || Oxidized.config.output.default) == 'gitcrypt' end - end end |