Class: Isomorfeus::Puppetmaster::Server::Checker
- Inherits:
-
Object
- Object
- Isomorfeus::Puppetmaster::Server::Checker
- Defined in:
- lib/isomorfeus/puppetmaster/server/checker.rb
Constant Summary collapse
- TRY_HTTPS_ERRORS =
[EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Checker
constructor
A new instance of Checker.
- #request(&block) ⇒ Object
- #ssl? ⇒ Boolean
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
20 21 22 |
# File 'lib/isomorfeus/puppetmaster/server/checker.rb', line 20 def ssl? @ssl end |