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
This commit is contained in:
parent
81545418af
commit
9e0edabed4
10
lib/puppet/parser/functions/parse_server_id.rb
Normal file
10
lib/puppet/parser/functions/parse_server_id.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
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
|
@ -25,7 +25,7 @@ class zanata::client(
|
|||||||
$homedir = '/home/jenkins/',
|
$homedir = '/home/jenkins/',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$serverid = regsubst($server, '\.', '_', 'G')
|
$server_id = parse_server_id($server_url)
|
||||||
|
|
||||||
file { '/opt/zanata':
|
file { '/opt/zanata':
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
@ -77,7 +77,7 @@ class zanata::client(
|
|||||||
ensure => present,
|
ensure => present,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${homedir}/.config/zanata.ini": # XXX needs to be in homedir
|
file { "${homedir}/.config/zanata.ini":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => $user,
|
owner => $user,
|
||||||
group => $group,
|
group => $group,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[servers]
|
[servers]
|
||||||
<%= @serverid -%>.url=<%= @server_url %>
|
<%= @server_id -%>.url=<%= @server_url %>
|
||||||
<%= @serverid -%>.username=<%= @server_user %>
|
<%= @server_id -%>.username=<%= @server_user %>
|
||||||
<%= @serverid -%>.key=<%= @server_api_key %>
|
<%= @server_id -%>.key=<%= @server_api_key %>
|
||||||
|
Loading…
Reference in New Issue
Block a user