summaryrefslogtreecommitdiff
path: root/lib/oxidized/output
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/output')
-rw-r--r--lib/oxidized/output/file.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb
index 66ad178..2ea2302 100644
--- a/lib/oxidized/output/file.rb
+++ b/lib/oxidized/output/file.rb
@@ -25,5 +25,20 @@ class OxFile < Output
open(file, 'w') { |fh| fh.write data }
end
+
+ def fetch node, group
+ cfg_dir = @cfg[:directory]
+ if group != 0 # group is explicitly defined by user
+ IO.readlines File.join(cfg_dir, group, node)
+ else
+ if File.exists? File.join(cfg_dir, node) # node configuration file is stored on base directory
+ IO.readlines File.join(cfg_dir, node)
+ else
+ path = Dir.glob File.join(cfg_dir, '**', node) # fetch node in all groups
+ open(path[0], 'r').readlines
+ end
+ end
+ end
+
end
end