From cc8fea7b25f9f3b758b7b2eae0f1aec82cc6644a Mon Sep 17 00:00:00 2001 From: Anton Aksola Date: Mon, 5 May 2014 15:36:28 +0300 Subject: Fixed crash if node vars_map not set in addition: - move vars helper to separate file - add csv support for node variables --- lib/oxidized/config/vars.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/oxidized/config/vars.rb (limited to 'lib/oxidized/config') 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 + -- cgit v1.2.1