diff options
-rw-r--r-- | lib/oxidized/nodes.rb | 3 | ||||
-rw-r--r-- | lib/oxidized/source/http.rb | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index 3f84e15..84cf956 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -12,7 +12,8 @@ module Oxidized @source = Oxidized.config.source.default Oxidized.mgr.add_source @source Oxidized.logger.info "lib/oxidized/nodes.rb: Loading nodes" - Oxidized.mgr.source[@source].new.load.each do |node| + nodes = Oxidized.mgr.source[@source].new.load node_want + nodes.each do |node| # we want to load specific node(s), not all of them next unless node_want? node_want, node begin diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb index 6c12f29..e4cb58e 100644 --- a/lib/oxidized/source/http.rb +++ b/lib/oxidized/source/http.rb @@ -15,7 +15,7 @@ class HTTP < Source require "uri" require "json" - def load + def load node=nil nodes = [] uri = URI.parse(@cfg.url) http = Net::HTTP.new(uri.host, uri.port) @@ -28,7 +28,11 @@ class HTTP < Source headers[header] = value end - request = Net::HTTP::Get.new(uri.request_uri, headers) + req_uri = uri.request_uri + if node + req_uri = "#{req_uri}/#{node}" + end + request = Net::HTTP::Get.new(req_uri, headers) if (@cfg.user? && @cfg.pass?) request.basic_auth(@cfg.user,@cfg.pass) end |