From b8150eae04924f2c45cdb0c4b3f60902c8ae3d96 Mon Sep 17 00:00:00 2001 From: nopedial Date: Wed, 23 Oct 2013 23:20:25 +0200 Subject: finalize fetch API call --- lib/oxidized/output/file.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 6e1a231..2ea2302 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -31,15 +31,11 @@ class OxFile < Output if group != 0 # group is explicitly defined by user IO.readlines File.join(cfg_dir, group, node) else - if File.exists?("#{cfg_dir}/#{node}") # node configuration file is stored on base directory + if File.exists? File.join(cfg_dir, node) # node configuration file is stored on base directory IO.readlines File.join(cfg_dir, node) else - file = - if file - open(file, 'r').readlines - else - "not found." - end + path = Dir.glob File.join(cfg_dir, '**', node) # fetch node in all groups + open(path[0], 'r').readlines end end end -- cgit v1.2.1