puppet-zanata/lib/puppet/parser/functions/parse_server_id.rb
Steve Kowalik 9e0edabed4 Correctly determine the server id
Due to using an undefined variable when determining the server id,
the client manifest was writing an incorrectly formatted zanata.ini
file. Furthermore, the intent of the change did not go far enough,
since it would not strip off the URI scheme or port. Due to the
complexities of parsing URIs in regular expressions, use a Puppet
function for the heavy lifting.

Change-Id: I754ee54f805c91f5548b2cf270b23c68eed3959c
2015-06-12 16:09:55 +10:00

11 lines
211 B
Ruby

require 'uri'
module Puppet::Parser::Functions
newfunction(:parse_server_id, :type => :rvalue) do |args|
uri = URI.parse(args[0])
unless uri.host.nil?
uri.host.gsub(/\./, '_')
end
end
end