From 63429fe9ec595df70a39de0944d893134899211e Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Wed, 11 Nov 2015 13:52:20 -0800 Subject: 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 --- .../lib/puppet/parser/functions/puppetdb_hostname.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb (limited to 'site/puppetdb_hostname_function/lib') diff --git a/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb b/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb new file mode 100644 index 0000000..b43365f --- /dev/null +++ b/site/puppetdb_hostname_function/lib/puppet/parser/functions/puppetdb_hostname.rb @@ -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 -- cgit v1.2.3