Class: Puppet::HTTP::Resolver Abstract
Overview
This class is abstract.
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) ⇒ Boolean
Check a given connection to establish if it can be relied on for future use.
-
#initialize(client) ⇒ Resolver
constructor
Create a new resolver.
-
#resolve(session, name, ssl_context: nil, canceled_handler: nil) ⇒ Object
Return a working server/port for the resolver.
Constructor Details
#initialize(client) ⇒ Resolver
Create a new resolver.
13 14 15 |
# File 'lib/puppet/http/resolver.rb', line 13 def initialize(client) @client = client end |
Instance Method Details
#check_connection?(session, service, ssl_context: nil) ⇒ Boolean
Check a given connection to establish if it can be relied on for future use.
43 44 45 46 47 48 49 |
# File 'lib/puppet/http/resolver.rb', line 43 def check_connection?(session, service, ssl_context: nil) service.connect(ssl_context: ssl_context) true rescue Puppet::HTTP::ConnectionError => e Puppet.log_exception(e, "Connection to #{service.url} failed, trying next route: #{e.}") false end |
#resolve(session, name, ssl_context: nil, canceled_handler: nil) ⇒ Object
Return a working server/port for the resolver. This is the base implementation and is meant to be a placeholder.
30 31 32 |
# File 'lib/puppet/http/resolver.rb', line 30 def resolve(session, name, ssl_context: nil, canceled_handler: nil) raise NotImplementedError end |