diff options
author | ytti <saku@ytti.fi> | 2013-10-24 02:18:00 -0700 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2013-10-24 02:18:00 -0700 |
commit | 1b4cf651d5b7e9e032a7bc0636c569d0419f2ded (patch) | |
tree | c94da76aee2709a2808a113115fa34b188a5a34c /lib/oxidized/api/rest.rb | |
parent | d7d490077ce16e76367773f5a5fe8bca4f84f366 (diff) | |
parent | feba4c2b9e0faeb40cad32f16d7b024a2d4327ae (diff) |
Merge pull request #7 from nopedial/master
finalize fetch API call
Diffstat (limited to 'lib/oxidized/api/rest.rb')
-rw-r--r-- | lib/oxidized/api/rest.rb | 8 |
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 |