diff options
author | Anton Aksola <anton.aksola@nebula.fi> | 2014-05-05 15:36:28 +0300 |
---|---|---|
committer | Anton Aksola <anton.aksola@nebula.fi> | 2014-05-05 15:36:28 +0300 |
commit | cc8fea7b25f9f3b758b7b2eae0f1aec82cc6644a (patch) | |
tree | e075b636c1ee5b9fbd6b94838e250f5bc113a1cd | |
parent | 16795edea8e14230b67b28e7e8503c2daffd69d2 (diff) |
Fixed crash if node vars_map not set
in addition:
- move vars helper to separate file
- add csv support for node variables
-rw-r--r-- | lib/oxidized/config/vars.rb | 10 |
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 + |