summaryrefslogtreecommitdiff
path: root/lib/oxidized/node.rb
diff options
context:
space:
mode:
authorNeil Lathwood <neil@lathwood.co.uk>2018-04-27 11:38:06 +0100
committerNeil Lathwood <neil@lathwood.co.uk>2018-04-27 11:38:06 +0100
commitb1194745929043b578c409f794ecb433aa515fa9 (patch)
tree133e7103073b707aaca855eb3df4d5025bebae06 /lib/oxidized/node.rb
parent9156243b9debfc0bc2b05dfe98a910ce5153bf49 (diff)
parent34fd5369feee94ab45c5a81d7769b1df717e4c8c (diff)
Rebased and fixed conflicts
Diffstat (limited to 'lib/oxidized/node.rb')
-rw-r--r--lib/oxidized/node.rb19
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