Skip to content

Commit c567a48

Browse files
raphinkZack Smith
authored andcommitted
find_nodes_puppetdb: get port from Util, tune ssl cx
1 parent 7c0fb4b commit c567a48

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/puppet/catalog-diff/searchfacts.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ def find_nodes_rest(server)
6565
end
6666

6767
def find_nodes_puppetdb()
68-
connection = Puppet::Network::HttpPool.http_instance(Puppet::Util::Puppetdb.server,'8081')
69-
base_query = ["and", ["=", ["node","active"], true]]
70-
query = base_query.concat(@facts.map { |k, v| ["=", ["fact", k], v] })
71-
json_query = URI.escape(query.to_json)
68+
require 'puppet/util/puppetdb'
69+
port = Puppet::Util::Puppetdb.port
70+
use_ssl = port != 8080
71+
connection = Puppet::Network::HttpPool.http_instance(Puppet::Util::Puppetdb.server,port,use_ssl)
72+
fact_query = @args.split("=")
73+
#json_query = URI.escape(["=", ["fact", fact_query[0]], fact_query[1]].to_json)
74+
json_query = URI.escape(["=", ["node","active"], true].to_json)
7275
unless filtered = PSON.load(connection.request_get("/v2/nodes/?query=#{json_query}", {"Accept" => 'application/json'}).body)
7376
raise "Error parsing json output of puppet search"
7477
end

0 commit comments

Comments
 (0)