diff options
author | Anton Aksola <anton.aksola@nebula.fi> | 2014-05-05 15:48:12 +0300 |
---|---|---|
committer | Anton Aksola <anton.aksola@nebula.fi> | 2014-05-05 15:48:12 +0300 |
commit | efa7ee3789ace917a66904252090986af0400c25 (patch) | |
tree | f88b93d614a40d92cadae07c357eda960a39757e /lib/oxidized/source | |
parent | cc8fea7b25f9f3b758b7b2eae0f1aec82cc6644a (diff) |
missing edits
Diffstat (limited to 'lib/oxidized/source')
-rw-r--r-- | lib/oxidized/source/csv.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/oxidized/source/csv.rb b/lib/oxidized/source/csv.rb index 9d291c7..113c272 100644 --- a/lib/oxidized/source/csv.rb +++ b/lib/oxidized/source/csv.rb @@ -20,11 +20,18 @@ class CSV < Source nodes = [] open(@cfg.file).each_line do |line| data = line.chomp.split @cfg.delimiter + # map node parameters keys = {} @cfg.map.each do |key, position| keys[key.to_sym] = data[position] end keys[:model] = map_model keys[:model] if keys.key? :model + + # map node specific vars, empty value is considered as nil + vars = {} + @cfg.vars_map.each { |key, position| vars[key.to_sym] = data[position].to_s.empty? ? nil : data[position] } + keys[:vars] = vars unless vars.empty? + nodes << keys end nodes |