summaryrefslogtreecommitdiffstats
path: root/lib/puppet/reports/http.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/reports/http.rb')
-rw-r--r--lib/puppet/reports/http.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/puppet/reports/http.rb b/lib/puppet/reports/http.rb
new file mode 100644
index 000000000..d74782cf8
--- /dev/null
+++ b/lib/puppet/reports/http.rb
@@ -0,0 +1,22 @@
+require 'puppet'
+require 'net/http'
+require 'uri'
+
+Puppet::Reports.register_report(:http) do
+
+ desc <<-DESC
+ Send report information via HTTP to the ``reporturl``. Each host sends
+ its report as a YAML dump and this sends this YAML to a client via HTTP POST.
+ The YAML is the `report` parameter of the request."
+ DESC
+
+ def process
+ url = URI.parse(Puppet[:reporturl])
+ req = Net::HTTP::Post.new(url.path)
+ req.body = self.to_yaml
+ req.content_type = "application/x-yaml"
+ Net::HTTP.new(url.host, url.port).start {|http|
+ http.request(req)
+ }
+ end
+end