diff options
author | ytti <saku@ytti.fi> | 2013-10-26 02:32:51 -0700 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2013-10-26 02:32:51 -0700 |
commit | f2acb9455edae1bc1c80de28af2362da9da206bf (patch) | |
tree | 3c92898daade43cdbbec317c07c2073b2a40e730 /lib/oxidized/output | |
parent | 4455a5b91accda5da7c1b8128cb045c7eb7bb5da (diff) | |
parent | 7982a7d3956910406e59952e1b215d5b4dd1d8e5 (diff) |
Merge pull request #8 from nopedial/master
ascii/json output initial differentiation
Diffstat (limited to 'lib/oxidized/output')
-rw-r--r-- | lib/oxidized/output/file.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/output/git.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 2ea2302..da778ff 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -28,7 +28,7 @@ class OxFile < Output def fetch node, group cfg_dir = @cfg[:directory] - if group != 0 # group is explicitly defined by user + if group # 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 diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index 202893c..f23b35a 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -37,6 +37,15 @@ class Git < Output end end + def fetch node, group + begin + repo = Repo.new(@cfg[:repo]) + (repo.tree / node).data + rescue + 'node not found' + end + end + private def update_repo repo, file, data, msg, actor |