Class: Puppet::Application::Puppetdbquery

Inherits:
FaceBase
  • Object
show all
Defined in:
modules/puppetdbquery/lib/puppet/application/puppetdbquery.rb

Class Method Summary collapse

Class Method Details

.settingObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'modules/puppetdbquery/lib/puppet/application/puppetdbquery.rb', line 4

def self.setting
  use_ssl = true
  begin
    require 'puppet'
    require 'puppet/util/puppetdb'
    PuppetDB::Connection.check_version
    uri = URI(Puppet::Util::Puppetdb.config.server_urls.first)
    host = uri.host
    port = uri.port
  rescue Exception => e
    Puppet.debug(e.message)
    host = 'puppetdb'
    port = 8081
  end

  Puppet.debug(host)
  Puppet.debug(port)
  Puppet.debug("use_ssl=#{use_ssl}")

  { :host => host,
    :port => port,
    :use_ssl => use_ssl
  }
end