Sha256: c868ae5f9ac2519e840f49527840037ce7231eb1a5a510372e9462dad047bdfc
Contents?: true
Size: 1.26 KB
Versions: 5
Compression:
Stored size: 1.26 KB
Contents
module IsItWorking class RubydoraCheck def initialize(options={}) @client = options[:client] raise ArgumentError.new(":client not specified") unless @client @host = @client.client.url @timeout = options[:timeout] || 2 @alias = options[:alias] || @host end def call(status) begin ping status.ok("service active") ["repositoryName", "repositoryBaseURL", "repositoryVersion"].each do |key| status.info("#{key} - #{profile[key]}") end rescue Errno::ECONNREFUSED status.fail("#{@alias} is not accepting connections on port #{@port.inspect}") rescue SocketError => e status.fail("connection to #{@alias} on port #{@port.inspect} failed with '#{e.message}'") rescue Timeout::Error status.fail("#{@alias} did not respond on port #{@port.inspect} within #{@timeout} seconds") end end def profile @luke ||= begin ActiveFedora::Base.connection_for_pid(0).profile rescue {} end end def ping timeout(@timeout) do s = TCPSocket.new(uri.host, uri.port) s.close end true end def uri URI(@host) end end end
Version data entries
5 entries across 5 versions & 1 rubygems