Class: Puppet::HTTP::Resolver::SRV

Inherits:
Puppet::HTTP::Resolver show all
Defined in:
lib/puppet/http/resolver/srv.rb

Instance Method Summary collapse

Constructor Details

#initialize(domain: srv_domain, dns: Resolv::DNS.new) ⇒ SRV


2
3
4
5
# File 'lib/puppet/http/resolver/srv.rb', line 2

def initialize(domain: srv_domain, dns: Resolv::DNS.new)
  @srv_domain = domain
  @delegate = Puppet::Network::Resolver.new(dns)
end

Instance Method Details

#resolve(session, name, &block) ⇒ Object


7
8
9
10
11
12
# File 'lib/puppet/http/resolver/srv.rb', line 7

def resolve(session, name, &block)
  # This assumes the route name is the same as the DNS SRV name
  @delegate.each_srv_record(@srv_domain, name) do |server, port|
    yield session.create_service(name, server, port)
  end
end