Method: Bolt::PuppetDB::Client#uri

Defined in:
lib/bolt/puppetdb/client.rb

#uriObject



171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/bolt/puppetdb/client.rb', line 171

def uri
  require 'addressable/uri'

  @current_url ||= (@config.server_urls - @bad_urls).first
  unless @current_url
    msg = "Failed to connect to all PuppetDB server_urls: #{@config.server_urls.to_a.join(', ')}."
    raise Bolt::PuppetDBError, msg
  end

  uri = Addressable::URI.parse(@current_url)
  uri.port ||= 8081
  uri
end