From e40a90fa3ecd60836ec5e86d9c5927b3bd2fe961 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Sat, 28 Apr 2018 00:14:51 +0200 Subject: [PATCH] Use httpd::vhost $content parameter Use the new $content parameter of httpd::vhost instead of $template. This way, the template gets rendered within the scope where it assumes most of its variables are, and doesn't need to use the scope object which doesn't work within a defined type. This will ensure the template keeps working on puppet 4. This also requires adjusting some of the template parameters that had previously been correctly scoped from the httpd::vhost defined type. Depends-On: https://review.openstack.org/570824 Change-Id: I3a45e99e3355d1e59d57d3d989cc03d253529bf2 --- manifests/site.pp | 7 ++++++- templates/vhost.erb | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/manifests/site.pp b/manifests/site.pp index c5a6225..f38e5df 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -14,11 +14,16 @@ define meetbot::site( $varlib = "/var/lib/meetbot/${name}" $meetbot = "/srv/meetbot-${name}" + $port = 80 + $docroot = "/srv/meetbot-${name}" + $srvname = $vhost_name + $_vhost_name = '*' + $options = 'Indexes FollowSymLinks MultiViews' ::httpd::vhost { $vhost_name: port => 80, docroot => "/srv/meetbot-${name}", priority => '50', - template => 'meetbot/vhost.erb', + content => template('meetbot/vhost.erb'), } file { $varlib: diff --git a/templates/vhost.erb b/templates/vhost.erb index 456d3cb..e5c4643 100644 --- a/templates/vhost.erb +++ b/templates/vhost.erb @@ -2,8 +2,8 @@ # Managed by Puppet # ************************************ -NameVirtualHost <%= @vhost_name %>:<%= @port %> -:<%= @port %>> +NameVirtualHost <%= @_vhost_name %>:<%= @port %> +:<%= @port %>> ServerName <%= @srvname %> <% if @serveraliases.is_a? Array -%> <% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> @@ -27,8 +27,8 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> <%= @vhost_extra %> - ErrorLog /var/log/apache2/<%= @name %>_error.log + ErrorLog /var/log/apache2/<%= @srvname %>_error.log LogLevel warn - CustomLog /var/log/apache2/<%= @name %>_access.log combined + CustomLog /var/log/apache2/<%= @srvname %>_access.log combined ServerSignature Off