From de1b7966d42b974e38a66bb6a3d8141f5ed317fd Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 27 Apr 2018 19:50:28 +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 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 --- templates/dual-elasticsearch.vhost.erb | 12 ++++++------ 1 file 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 @@ # as well as arbitrary searches using the elasticsearch search api. RewriteEngine on RewriteCond %{REQUEST_METHOD} GET - RewriteRule ^<%= @elasticsearch_prefix %>((.*/)?_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping(/field(/.*)?)?|_cluster/(health|state(/.*)?)|_nodes(/stats)?)$ <%= @elasticsearch_url %>/$1 [P] + 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] RewriteCond %{REQUEST_METHOD} POST - RewriteRule ^<%= @elasticsearch_prefix %>(_aliases|(.*/)?_search)$ <%= @elasticsearch_url %>/$1 [P] + RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>(_aliases|(.*/)?_search)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P] RewriteCond %{REQUEST_METHOD} OPTIONS - RewriteRule ^<%= @elasticsearch_prefix %>((.*/)?_search)$ <%= @elasticsearch_url %>/$1 [P] - /> - ProxySet connectiontimeout=<%= @vhost_proxy_connect_timeout %> timeout=<%= @vhost_proxy_timeout %> + RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>((.*/)?_search)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P] + /> + ProxySet connectiontimeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_connect_timeout') %> timeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_timeout') %> - ProxyPassReverse <%= @elasticsearch_prefix %> <%= @elasticsearch_url %>/ + ProxyPassReverse <%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %> <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/ DocumentRoot <%= docroot %>