summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornopedial <shafez@ike-2.local>2013-10-15 22:20:57 +0200
committernopedial <shafez@ike-2.local>2013-10-15 22:20:57 +0200
commitff5f75ad040fc40484ee186e609e8b5af668d7ae (patch)
treed114283eed36efc9ee7e7b5f0bcec162578b99f6
parente9ec48a85006b481007db28d0b1fb7344f1d1224 (diff)
fix fetch search and broken output
-rw-r--r--lib/oxidized/output/file.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb
index 08272a5..8a53f91 100644
--- a/lib/oxidized/output/file.rb
+++ b/lib/oxidized/output/file.rb
@@ -34,15 +34,11 @@ class OxFile < Output
if File.exists?("#{cfg_dir}/#{node}") # node configuration file is stored on base directory
IO.readlines File.join(cfg_dir, node)
else
- Dir.foreach(cfg_dir) do |sub_dir|
- next if sub_dir == '.' or sub_dir == '..'
- if File.directory?("#{cfg_dir}/#{sub_dir}")
- files = Dir.entries("#{cfg_dir}/#{sub_dir}")
- files.each do |f|
- next if File.directory?("#{cfg_dir}/#{sub_dir}/#{f}") or f == '.' or f == '..'
- IO.readlines File.join(cfg_dir, sub_dir, f) if f == node # node configuration file found on sub directory
- end
- end
+ file = Find.find('.').lazy.find{|e|e.match /#{node}/}
+ if file
+ open(file, 'r').readlines
+ else
+ "not found."
end
end
end