summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColleen Murphy <colleen@gazlene.net>2018-04-27 22:49:35 +0200
committerColleen Murphy <colleen@gazlene.net>2018-05-09 15:00:33 -0700
commit281acd62ab137d139912a7335b923282baf571eb (patch)
tree9c0c2cd2efd9cb9160c53b1dc5875eed2ebe1d76
parent31e44bbcb053b3d057c0ca72669b6f0e860f2039 (diff)
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: I8d2b351537ad8fc0a06c58e1dd23d8423f38a328
Notes
Notes (review): Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Code-Review+2: Ian Wienand <iwienand@redhat.com> Workflow+1: Ian Wienand <iwienand@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 19 Jun 2018 22:45:03 +0000 Reviewed-on: https://review.openstack.org/564882 Project: openstack-infra/puppet-ethercalc Branch: refs/heads/master
-rw-r--r--templates/ethercalc.vhost.erb15
1 files changed, 8 insertions, 7 deletions
diff --git a/templates/ethercalc.vhost.erb b/templates/ethercalc.vhost.erb
index 5c587fd..2b048b3 100644
--- a/templates/ethercalc.vhost.erb
+++ b/templates/ethercalc.vhost.erb
@@ -38,20 +38,21 @@
38 # MSIE 7 and newer should be able to use keepalive 38 # MSIE 7 and newer should be able to use keepalive
39 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown 39 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
40 40
41 <% if @auth_openid != nil %> 41 <% auth_openid = scope["ethercalc::apache::auth_openid"] %>
42 <% if ! [nil, :undef].include?(auth_openid) %>
42 <Location /> 43 <Location />
43 AuthType OpenID 44 AuthType OpenID
44 AuthName "<%= @auth_openid['banner'] %>" 45 AuthName "<%= auth_openid['banner'] %>"
45 AuthOpenIDSecureCookie On 46 AuthOpenIDSecureCookie On
46 AuthOpenIDCookieLifespan 3600 47 AuthOpenIDCookieLifespan 3600
47 AuthOpenIDTrustRoot https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %> 48 AuthOpenIDTrustRoot https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %>
48 AuthOpenIDServerName https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %> 49 AuthOpenIDServerName https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %>
49 AuthOpenIDSingleIdP <%= @auth_openid['singleIdp'] %> 50 AuthOpenIDSingleIdP <%= auth_openid['singleIdp'] %>
50 AuthOpenIDTrusted <%= @auth_openid['trusted'] %> 51 AuthOpenIDTrusted <%= auth_openid['trusted'] %>
51 <% if @auth_openid['any_valid_user'] %> 52 <% if auth_openid['any_valid_user'] %>
52 Require valid-user 53 Require valid-user
53 <% elsif !@auth_openid['users'].empty? %> 54 <% elsif !auth_openid['users'].empty? %>
54 <% @auth_openid['users'].each do |user| -%> 55 <% auth_openid['users'].each do |user| -%>
55 Require user <%= user %> 56 Require user <%= user %>
56 <% end -%> 57 <% end -%>
57 <% end %> 58 <% end %>