diff options
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | lib/oxidized/output/file.rb | 13 | 
2 files changed, 8 insertions, 7 deletions
| diff --git a/Gemfile.lock b/Gemfile.lock index 373fdbe..ab52715 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@  PATH    remote: .    specs: -    oxidized (0.17.0) +    oxidized (0.18.0)        asetus (~> 0.1)        net-ssh (~> 3.0.2)        net-telnet diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 851e4c5..78db1d5 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -28,18 +28,19 @@ class OxidizedFile < Output    end    def fetch node, group -    cfg_dir = File.expand_path @cfg.directory +    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_name) +      cfg_dir = File.join File.dirname(cfg_dir), group +      File.read File.join(cfg_dir, node_name)      else        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) +        File.read File.join(cfg_dir, node_name)        else -        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 +        path = Dir.glob(File.join(cfg_dir, '**', node_name)).first # fetch node in all groups +        return nil if not path +        File.read path        end      end    end | 
