Class: Isomorfeus::Puppetmaster::Server::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/isomorfeus/puppetmaster/server/checker.rb

Constant Summary collapse

TRY_HTTPS_ERRORS =
[EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Checker

Returns a new instance of Checker.



7
8
9
10
# File 'lib/isomorfeus/puppetmaster/server/checker.rb', line 7

def initialize(host, port)
  @host, @port = host, port
  @ssl = false
end

Instance Method Details

#request(&block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/isomorfeus/puppetmaster/server/checker.rb', line 12

def request(&block)
  ssl? ? https_request(&block) : http_request(&block)
rescue *TRY_HTTPS_ERRORS
  res = https_request(&block)
  @ssl = true
  res
end

#ssl?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/isomorfeus/puppetmaster/server/checker.rb', line 20

def ssl?
  @ssl
end