From 3f8567fc9c7d707574f834f5728f8c1f6ea3e8c1 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 19 Jan 2018 08:47:43 -0800 Subject: [PATCH] Create per-site template directories Install user-specified languages there. English by default. This is not used yet; it will be enabled in a later change. Change-Id: I1d3b0f1a96ade33b0d72accf3a7c8449e79b6c5f --- manifests/site.pp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/manifests/site.pp b/manifests/site.pp index 5c2c03e..b79c99b 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -13,7 +13,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -define mailman::site ($default_email_host, $default_url_host) +# This processes the passed in directory (which should be like +# "/srv/mailman/something/templates/en") to identify the language and +# creates a symlink to the target installed templates for that +# language. + +define mailman::language_link() +{ + $parts = split($name, '/') + $lname = $parts[-1] + $target = sprintf('/usr/share/mailman/%s', $lname) + + file { $name: + ensure => link, + target => $target, + } +} + +define mailman::site ( + $default_email_host, + $default_url_host, + $install_languages = ['en']) { include ::httpd @@ -31,6 +51,7 @@ define mailman::site ($default_email_host, $default_url_host) "${root}/archives", "${root}/archives/public", "${root}/archives/private", + "${root}/templates", "${root}/qfiles", "${root}/qfiles/in", "${root}/qfiles/out", @@ -52,6 +73,10 @@ define mailman::site ($default_email_host, $default_url_host) mode => '2775', } + $install_template_dirs = regsubst ($install_languages, '^(.*)$', "${root}/templates/\\1") + + mailman::language_link { $install_template_dirs: } + file { "/srv/mailman/${name}/etc/mm_cfg_local.py": ensure => present, content => template('mailman/mm_site_cfg.py.erb'),