lib/deputy.rb in deputy-0.1.44 vs lib/deputy.rb in deputy-0.1.45
- old
+ new
@@ -118,16 +118,19 @@
rescue Exception => e
send_report "Deputies.Error", e.message
raise e
end
- def self.send_report(group, value)
+ def self.send_report(group, value, options = {})
raise "separate #{group} with a ." unless group.split('.',2).size == 2
- get "/notify?group=#{CGI.escape group}&value=#{CGI.escape value.to_s}&hostname=#{Socket.gethostname}"
+ host = options[:host] || Socket.gethostname
+
+ get "/notify?group=#{CGI.escape group}&value=#{CGI.escape value.to_s}&hostname=#{host}"
end
def self.get(path, options = {})
url = "#{sheriff_url}#{path}"
+ url = "http://#{url}" unless url =~ %r{://}
options[:http_basic_authentication] = extract_auth_from_url!(url)
Timeout.timeout(config['timeout']||10) do
open(url, options).read
end
\ No newline at end of file