Fix scope of vhost template variables

Dynamic scoping for variables in ERB templates was removed in puppet
4[1] which means that the variables defined in the manifests cannot be
found when it is referenced in the httpd::vhost defined type and will be
evaluated as nil when puppet runs. Use scope.lookupvar instead to be
explicit about the variable's source.

[1] https://puppet.com/docs/puppet/4.10/lang_updating_manifests.html#dynamic-scoping-in-erb

Change-Id: I007975c920bd12a352acdea742b841a17ecc5d17
This commit is contained in:
Colleen Murphy 2018-04-27 21:24:23 +02:00
parent 85896f5c03
commit 6153eec795
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@
CustomLog ${APACHE_LOG_DIR}/storyboard-access.log combined CustomLog ${APACHE_LOG_DIR}/storyboard-access.log combined
<Directory "<%= scope.lookupvar("storyboard::application::install_root") %>"> <Directory "<%= scope.lookupvar("storyboard::application::install_root") %>">
<% if @new_vhost_perms %> <% if scope.lookupvar("storyboard::application::new_vhost_perms") %>
Require all granted Require all granted
<% else %> <% else %>
Order allow,deny Order allow,deny

View File

@ -55,7 +55,7 @@
WSGIPassAuthorization On WSGIPassAuthorization On
<Directory "<%= scope.lookupvar("storyboard::application::install_root") %>"> <Directory "<%= scope.lookupvar("storyboard::application::install_root") %>">
<% if @new_vhost_perms %> <% if scope.lookupvar("storyboard::application::new_vhost_perms") %>
Require all granted Require all granted
<% else %> <% else %>
Order allow,deny Order allow,deny