summaryrefslogtreecommitdiff
path: root/lib/oxidized/config/vars.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2015-12-30 15:43:26 +0200
committerytti <saku@ytti.fi>2015-12-30 15:43:26 +0200
commitb631223b397dc56c8734bccd4867c013f4f2219e (patch)
treee962408f0f62447ef09b1f1efa0c4b9c8fe46685 /lib/oxidized/config/vars.rb
parenta6f7f8de57d3c2691ff68375aeda78e880e58384 (diff)
parent6e72e399626c0abb4cff7cea3d96505d4971e646 (diff)
Merge pull request #253 from supertylerc/242-bug/fix-groups-vars
Fix groups vars.
Diffstat (limited to 'lib/oxidized/config/vars.rb')
-rw-r--r--lib/oxidized/config/vars.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/oxidized/config/vars.rb b/lib/oxidized/config/vars.rb
index b39e7fe..b0471f2 100644
--- a/lib/oxidized/config/vars.rb
+++ b/lib/oxidized/config/vars.rb
@@ -2,9 +2,14 @@ module Oxidized::Config::Vars
# convenience method for accessing node, group or global level user variables
# nil values will be ignored
def vars name
- r = @node.vars[name] unless @node.vars.nil?
- r ||= Oxidized::CFG.groups[@node.group].vars[name.to_s] if Oxidized::CFG.groups.has_key?(@node.group)
+ r = @node.vars[name] unless @node.vars.nil?
+ if Oxidized::CFG.groups.has_key?(@node.group)
+ if Oxidized::CFG.groups[@node.group].vars.has_key?(name.to_s)
+ r ||= Oxidized::CFG.groups[@node.group].vars[name.to_s]
+ end
+ end
r ||= Oxidized::CFG.vars[name.to_s] if Oxidized::CFG.vars.has_key?(name.to_s)
r
end
end
+