summaryrefslogtreecommitdiff
path: root/lib/oxidized/node.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2018-04-25 16:12:44 +0300
committerGitHub <noreply@github.com>2018-04-25 16:12:44 +0300
commit583bc422448a234a215113a15f8a6976c50b2296 (patch)
treeb3f757e6f37aa058a0c80e4ded3ef82553bc98c1 /lib/oxidized/node.rb
parent9a7d16c00163c421d2c9f3cb2783c76633860336 (diff)
parentdffae0f76656a57da8f5473ce21955638cbe1f7f (diff)
Merge pull request #1296 from wk/the-great-makeover
the great makeover - standardize layout, alignment, indentation
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