summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColleen Murphy <colleen@gazlene.net>2018-04-27 19:50:28 +0200
committerColleen Murphy <colleen@gazlene.net>2018-04-27 19:50:28 +0200
commitde1b7966d42b974e38a66bb6a3d8141f5ed317fd (patch)
treec0996bcae99ba365446b6d756ad45ba6c06981a2
parent65192133b7765b974d5d13e3580da32c8b97c970 (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 kibana::js class 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: I27a63e74bda27269145b58e6d237c440085f0709
Notes
Notes (review): Code-Review+2: Joshua Hesketh <josh@nitrotech.org> Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 12 Jun 2018 22:33:33 +0000 Reviewed-on: https://review.openstack.org/564853 Project: openstack-infra/puppet-kibana Branch: refs/heads/master
-rw-r--r--templates/dual-elasticsearch.vhost.erb12
1 files changed, 6 insertions, 6 deletions
diff --git a/templates/dual-elasticsearch.vhost.erb b/templates/dual-elasticsearch.vhost.erb
index 3f6ef0a..befa506 100644
--- a/templates/dual-elasticsearch.vhost.erb
+++ b/templates/dual-elasticsearch.vhost.erb
@@ -21,15 +21,15 @@
21 # as well as arbitrary searches using the elasticsearch search api. 21 # as well as arbitrary searches using the elasticsearch search api.
22 RewriteEngine on 22 RewriteEngine on
23 RewriteCond %{REQUEST_METHOD} GET 23 RewriteCond %{REQUEST_METHOD} GET
24 RewriteRule ^<%= @elasticsearch_prefix %>((.*/)?_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping(/field(/.*)?)?|_cluster/(health|state(/.*)?)|_nodes(/stats)?)$ <%= @elasticsearch_url %>/$1 [P] 24 RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>((.*/)?_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping(/field(/.*)?)?|_cluster/(health|state(/.*)?)|_nodes(/stats)?)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P]
25 RewriteCond %{REQUEST_METHOD} POST 25 RewriteCond %{REQUEST_METHOD} POST
26 RewriteRule ^<%= @elasticsearch_prefix %>(_aliases|(.*/)?_search)$ <%= @elasticsearch_url %>/$1 [P] 26 RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>(_aliases|(.*/)?_search)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P]
27 RewriteCond %{REQUEST_METHOD} OPTIONS 27 RewriteCond %{REQUEST_METHOD} OPTIONS
28 RewriteRule ^<%= @elasticsearch_prefix %>((.*/)?_search)$ <%= @elasticsearch_url %>/$1 [P] 28 RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>((.*/)?_search)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P]
29 <Proxy <%= @elasticsearch_url %>/> 29 <Proxy <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/>
30 ProxySet connectiontimeout=<%= @vhost_proxy_connect_timeout %> timeout=<%= @vhost_proxy_timeout %> 30 ProxySet connectiontimeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_connect_timeout') %> timeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_timeout') %>
31 </Proxy> 31 </Proxy>
32 ProxyPassReverse <%= @elasticsearch_prefix %> <%= @elasticsearch_url %>/ 32 ProxyPassReverse <%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %> <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/
33 </IfModule> 33 </IfModule>
34 34
35 DocumentRoot <%= docroot %> 35 DocumentRoot <%= docroot %>