lib/deputy.rb in deputy-0.1.31 vs lib/deputy.rb in deputy-0.1.33
- old
+ new
@@ -116,13 +116,17 @@
def self.send_report(group, value)
raise "separate #{group} with a ." unless group.split('.',2).size == 2
get "/notify?group=#{CGI.escape group}&value=#{CGI.escape value.to_s}"
end
- def self.get(path)
+ def self.get(path, options = {})
+
url = "#{sheriff_url}#{path}"
+ url = url.sub(%r{(.*?):.(*?)@}, '')
+ auth = [$1, $2].compact
+ options = {:http_basic_authentication => auth} if auth.size == 2
Timeout.timeout(config['timeout']||10) do
- open(url).read
+ open(url, options).read
end
rescue => e
e.message << url.to_s
raise e
end
\ No newline at end of file