From 1de34a782d5e0c8522f0c0558c3958c337f15076 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 27 Apr 2018 22:44:03 +0200 Subject: [PATCH] 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 manifest 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: Ifc1db7851d2a0cd39af9f05b55ec9a546a12f567 --- templates/drupal.vhost.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/drupal.vhost.erb b/templates/drupal.vhost.erb index 0994621..5b99c7d 100644 --- a/templates/drupal.vhost.erb +++ b/templates/drupal.vhost.erb @@ -5,7 +5,7 @@ NameVirtualHost <%= @vhost_name %>:80 :80> -<% if @site_ssl_enabled %> +<% if scope.lookupvar('::drupal::site_ssl_enabled') %> ServerName <%= @srvname %> Redirect / https://<%= @srvname %>/ @@ -14,10 +14,10 @@ NameVirtualHost <%= @vhost_name %>:443 :443> SSLEngine on SSLProtocol All -SSLv2 -SSLv3 - SSLCertificateFile <%= @site_ssl_cert_file %> - SSLCertificateKeyFile <%= @site_ssl_key_file %> -<% if @site_ssl_chain_file_contents %> - SSLCertificateChainFile <%= @site_ssl_chain_file %> + SSLCertificateFile <%= scope.lookupvar('::drupal::site_ssl_cert_file') %> + SSLCertificateKeyFile <%= scope.lookupvar('::drupal::site_ssl_key_file') %> +<% if scope.lookupvar('::drupal::site_ssl_chain_file_contents') %> + SSLCertificateChainFile <%= scope.lookupvar('::drupal::site_ssl_chain_file') %> <% end %> <% end %> ServerName <%= @srvname %> @@ -30,7 +30,7 @@ NameVirtualHost <%= @vhost_name %>:443 > Options FollowSymLinks MultiViews AllowOverride None - <% if @new_vhost_perms %> + <% if scope.lookupvar('::drupal::new_vhost_perms') %> Require all granted <% else %> Order allow,deny