summaryrefslogtreecommitdiff
path: root/lib/oxidized/config/vars.rb
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiyev@gmail.com>2016-01-04 11:00:14 -0500
committerElvin Efendi <elvin.efendiyev@gmail.com>2016-01-04 11:00:14 -0500
commite41f7b429901eb38ad785ad1fc2527dd41f35959 (patch)
tree02ba46c4f7d43b5721f3eb7de38599e0e019e5cf /lib/oxidized/config/vars.rb
parentef1a59d2b29df5b00246ee34eba96b0cf4927fa2 (diff)
parentf339170c877ca296987d66c0c44223a8cad1d338 (diff)
Merge pull request #17 from Shopify/merge-upstream
Merge upstream
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 10f39c3..09f9781 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.config.groups[@node.group].vars[name.to_s] if Oxidized.config.groups.has_key?(@node.group)
+ r = @node.vars[name] unless @node.vars.nil?
+ if Oxidized.config.groups.has_key?(@node.group)
+ if Oxidized.config.groups[@node.group].vars.has_key?(name.to_s)
+ r ||= Oxidized.config.groups[@node.group].vars[name.to_s]
+ end
+ end
r ||= Oxidized.config.vars[name.to_s] if Oxidized.config.vars.has_key?(name.to_s)
r
end
end
+