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
This commit is contained in:
Colleen Murphy 2018-04-28 00:14:51 +02:00 committed by Colleen Murphy
parent b44d392811
commit e40a90fa3e
2 changed files with 10 additions and 5 deletions

View File

@ -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:

View File

@ -2,8 +2,8 @@
# Managed by Puppet
# ************************************
NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
NameVirtualHost <%= @_vhost_name %>:<%= @port %>
<VirtualHost <%= @_vhost_name %>:<%= @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
</VirtualHost>