diff options
author | nopedial <shafez@ike-2.local> | 2013-10-10 01:22:11 +0200 |
---|---|---|
committer | nopedial <shafez@ike-2.local> | 2013-10-10 01:22:11 +0200 |
commit | f5be715f06da3e32557e1b5ecfbe762f7d547a97 (patch) | |
tree | ef092b1e9c29ca9b3df4b0e7010c44f14070c5d1 /lib/oxidized/api | |
parent | b19297dde99dfa2430f96ab90b9daeed2a9f340b (diff) |
primitive ascii configuration fetch API
Diffstat (limited to 'lib/oxidized/api')
-rw-r--r-- | lib/oxidized/api/rest.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/oxidized/api/rest.rb b/lib/oxidized/api/rest.rb index 783b445..a2ff1ab 100644 --- a/lib/oxidized/api/rest.rb +++ b/lib/oxidized/api/rest.rb @@ -41,6 +41,19 @@ module Oxidized # /nodes/show/node - returns data about node when /show\/(.*)/ send res, @nodes.show($1) + when /fetch\/(.*)/ # primitive node fetch implementation for file config - /nodes/fetch/$ip_address + if CFG.output[:default] == "file" # ugly hack to disable configuration fetch for non ascii configurations + @cfg_root = CFG.output[:file] + File.open("#{@cfg_root[:directory]}/#{$1}", "r") do |pipe| + @res_config = [] + while ( line = pipe.gets ) do + @res_config << line # store configuration into an array to format and send + end + end + send res, @res_config + else + send res, "oxidized 0.0.14 support fetch for ascii configuration files only." # return error to end user + end end end end |