Add custom functions for determining some PE settings

Added a function to find the hostname and port of the classifier

Added a fucntion to return all puppetdb hostnames
This commit is contained in:
Nick Walker 2015-11-11 13:52:20 -08:00
parent a9d3be58aa
commit 63429fe9ec
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,5 @@
module Puppet::Parser::Functions
newfunction(:puppet_master_classifer_settings, :type => :rvalue) do |args|
function_parseyaml([function_file([File.join(lookupvar('settings::confdir').to_s, 'classifier.yaml')])])
end
end

View File

@ -0,0 +1,12 @@
require 'puppet/util/puppetdb'
module Puppet::Parser::Functions
newfunction(:puppetdb_hostnames, :type => :rvalue) do |args|
output = []
Puppet::Util::Puppetdb.config.server_urls.each do | server_url |
output << server_url.hostname
end
output
end
end