summaryrefslogtreecommitdiff
path: root/lib/oxidized/config
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/config')
-rw-r--r--lib/oxidized/config/vars.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/oxidized/config/vars.rb b/lib/oxidized/config/vars.rb
new file mode 100644
index 0000000..bc94049
--- /dev/null
+++ b/lib/oxidized/config/vars.rb
@@ -0,0 +1,10 @@
+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]
+ r ||= CFG.groups[@node.group].vars[name.to_s] if CFG.groups.has_key?(@node.group)
+ r ||= CFG.vars[name.to_s]
+ end
+end
+