Browse Source

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
changes/53/564853/1
Colleen Murphy 1 year ago
parent
commit
de1b7966d4
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      templates/dual-elasticsearch.vhost.erb

+ 6
- 6
templates/dual-elasticsearch.vhost.erb View File

@@ -21,15 +21,15 @@
21 21
     # as well as arbitrary searches using the elasticsearch search api.
22 22
     RewriteEngine on
23 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 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 27
     RewriteCond %{REQUEST_METHOD} OPTIONS
28
-    RewriteRule ^<%= @elasticsearch_prefix %>((.*/)?_search)$ <%= @elasticsearch_url %>/$1 [P]
29
-    <Proxy <%= @elasticsearch_url %>/>
30
-      ProxySet connectiontimeout=<%= @vhost_proxy_connect_timeout %> timeout=<%= @vhost_proxy_timeout %>
28
+    RewriteRule ^<%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %>((.*/)?_search)$ <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/$1 [P]
29
+    <Proxy <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/>
30
+      ProxySet connectiontimeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_connect_timeout') %> timeout=<%= scope.lookupvar('::kibana::js::vhost_proxy_timeout') %>
31 31
     </Proxy>
32
-    ProxyPassReverse <%= @elasticsearch_prefix %> <%= @elasticsearch_url %>/
32
+    ProxyPassReverse <%= scope.lookupvar('::kibana::js::elasticsearch_prefix') %> <%= scope.lookupvar('::kibana::js::elasticsearch_url') %>/
33 33
   </IfModule>
34 34
 
35 35
   DocumentRoot <%= docroot %>

Loading…
Cancel
Save