diff options
Diffstat (limited to 'lib/oxidized/api/rest.rb')
-rw-r--r-- | lib/oxidized/api/rest.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/oxidized/api/rest.rb b/lib/oxidized/api/rest.rb index 783b445..d1bd7dc 100644 --- a/lib/oxidized/api/rest.rb +++ b/lib/oxidized/api/rest.rb @@ -41,6 +41,18 @@ module Oxidized # /nodes/show/node - returns data about node when /show\/(.*)/ send res, @nodes.show($1) + # /nodes/fetch/<node> or /nodes/fetch/group/<group>/<node> - returns json formatted configuration file for <node> + when /fetch\/(.*)/ + begin + if $1.include? '/' + group, node = $1.split("/")[1..2] + else + group, node = 0, $1 + end + send res, @nodes.fetch(node, group) + rescue Oxidized::NotSupported => e + send res, e + end end end end |