Class: Puppet::HTTP::Resolver Abstract Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Subclass and override #resolve to create a new resolver.
Resolver base class. Each resolver represents a different strategy for resolving a service name into a list of candidate servers and ports.
Direct Known Subclasses
Defined Under Namespace
Classes: SRV, ServerList, Settings
Instance Method Summary collapse
-
#check_connection?(session, service, ssl_context: nil, error_handler: nil) ⇒ Boolean
private
Check a given connection to establish if it can be relied on for future use.
-
#initialize(client) ⇒ Resolver
constructor
private
Create a new resolver.
-
#resolve(session, name, ssl_context: nil, error_handler: nil) ⇒ Object
private
Return a working server/port for the resolver.
Constructor Details
#initialize(client) ⇒ Resolver
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new resolver
17 18 19 |
# File 'lib/puppet/http/resolver.rb', line 17 def initialize(client) @client = client end |
Instance Method Details
#check_connection?(session, service, ssl_context: nil, error_handler: nil) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check a given connection to establish if it can be relied on for future use
53 54 55 56 57 58 59 60 |
# File 'lib/puppet/http/resolver.rb', line 53 def check_connection?(session, service, ssl_context: nil, error_handler: nil) service.connect(ssl_context: ssl_context) return true rescue Puppet::HTTP::ConnectionError => e error_handler.call(e) if error_handler Puppet.debug("Connection to #{service.url} failed, trying next route: #{e.}") return false end |
#resolve(session, name, ssl_context: nil, error_handler: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a working server/port for the resolver. This is the base implementation and is meant to be a placeholder.
36 37 38 |
# File 'lib/puppet/http/resolver.rb', line 36 def resolve(session, name, ssl_context: nil, error_handler: nil) raise NotImplementedError end |