From 699136c8c3a1a409a2eaa19019ec6df6bb4b61e0 Mon Sep 17 00:00:00 2001 From: Danilo Sousa Date: Mon, 29 Aug 2016 16:42:06 -0300 Subject: fix the node variable from `#fetch`. closes #529 in commit `de2a9d1` I changed the `#fetch` method to pass the `Node` object instead of the node name. --- lib/oxidized/output/file.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 0b64447..851e4c5 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -29,13 +29,15 @@ class OxidizedFile < Output def fetch node, group cfg_dir = File.expand_path @cfg.directory + node_name = node.name + if group # group is explicitly defined by user - IO.readlines File.join(cfg_dir, group, node) + IO.readlines File.join(cfg_dir, group, node_name) else - if File.exists? File.join(cfg_dir, node) # node configuration file is stored on base directory - IO.readlines File.join(cfg_dir, node) + if File.exists? File.join(cfg_dir, node_name) # node configuration file is stored on base directory + IO.readlines File.join(cfg_dir, node_name) else - path = Dir.glob File.join(cfg_dir, '**', node) # fetch node in all groups + path = Dir.glob File.join(cfg_dir, '**', node_name) # fetch node in all groups return nil if path[0].nil? open(path[0], 'r').readlines end -- cgit v1.2.1