summaryrefslogtreecommitdiff
path: root/lib/oxidized/api/rest.rb
diff options
context:
space:
mode:
authornopedial <shafez@ike-2.local>2013-10-15 00:13:03 +0200
committernopedial <shafez@ike-2.local>2013-10-15 00:13:03 +0200
commite9ec48a85006b481007db28d0b1fb7344f1d1224 (patch)
tree6af63a41d40e60622d00af83e37e14c983e88d9b /lib/oxidized/api/rest.rb
parentfb4bc13364624bd8d78659de52bb5180c040cb0e (diff)
enhance fetch support
Diffstat (limited to 'lib/oxidized/api/rest.rb')
-rw-r--r--lib/oxidized/api/rest.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/oxidized/api/rest.rb b/lib/oxidized/api/rest.rb
index d876917..d1bd7dc 100644
--- a/lib/oxidized/api/rest.rb
+++ b/lib/oxidized/api/rest.rb
@@ -41,9 +41,15 @@ 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
- send res, @nodes.fetch($1)
+ 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