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 openstackci::logserver 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: Iea37fb14bc332cbf2d598b908bce997786814924
This commit is contained in:
parent
7a4e625ca1
commit
ef5e2f1034
@ -57,14 +57,14 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
|||||||
Satisfy Any
|
Satisfy Any
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<% @readmes.each do |pattern, helpfile| -%>
|
<% scope.lookupvar('::openstackci::logserver::readmes').each do |pattern, helpfile| -%>
|
||||||
<Directory <%= @docroot %><%= pattern %>>
|
<Directory <%= @docroot %><%= pattern %>>
|
||||||
ReadmeName <%= helpfile %>
|
ReadmeName <%= helpfile %>
|
||||||
</Directory>
|
</Directory>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
<% if @ara_middleware -%>
|
<% if scope.lookupvar('::openstackci::logserver::ara_middleware') -%>
|
||||||
<Directory "/usr/local/bin">
|
<Directory "/usr/local/bin">
|
||||||
<Files "ara-wsgi-sqlite">
|
<Files "ara-wsgi-sqlite">
|
||||||
Allow from all
|
Allow from all
|
||||||
@ -73,20 +73,20 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
|||||||
</Directory>
|
</Directory>
|
||||||
# ARA sqlite middleware configuration
|
# ARA sqlite middleware configuration
|
||||||
# See docs for details: https://ara.readthedocs.io/en/latest/advanced.html
|
# See docs for details: https://ara.readthedocs.io/en/latest/advanced.html
|
||||||
SetEnv ARA_WSGI_TMPDIR_MAX_AGE <%= @ara_middleware_tmpdir_max_age %>
|
SetEnv ARA_WSGI_TMPDIR_MAX_AGE <%= scope.lookupvar('::openstackci::logserver::ara_middleware_tmpdir_max_age') %>
|
||||||
SetEnv ARA_WSGI_LOG_ROOT <%= @docroot %>
|
SetEnv ARA_WSGI_LOG_ROOT <%= @docroot %>
|
||||||
SetEnv ARA_WSGI_DATABASE_DIRECTORY <%= @ara_middleware_database_directory %>
|
SetEnv ARA_WSGI_DATABASE_DIRECTORY <%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>
|
||||||
|
|
||||||
# Redirect .*/<%= @ara_middleware_database_directory %> to the ARA sqlite wsgi middleware
|
# Redirect .*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %> to the ARA sqlite wsgi middleware
|
||||||
# This middleware automatically loads the ARA web application with the
|
# This middleware automatically loads the ARA web application with the
|
||||||
# database located at .*/<%= @ara_middleware_database_directory %>/ansible.sqlite.
|
# database located at .*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>/ansible.sqlite.
|
||||||
# If we get a request directly to the database file, don't load the middleware
|
# If we get a request directly to the database file, don't load the middleware
|
||||||
# so that users can download the raw database if they wish.
|
# so that users can download the raw database if they wish.
|
||||||
WSGIScriptAliasMatch ^.*/<%= @ara_middleware_database_directory %>(?!/ansible.sqlite) /usr/local/bin/ara-wsgi-sqlite
|
WSGIScriptAliasMatch ^.*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>(?!/ansible.sqlite) /usr/local/bin/ara-wsgi-sqlite
|
||||||
|
|
||||||
# Everything beyond this point is rewritten to htmlify.
|
# Everything beyond this point is rewritten to htmlify.
|
||||||
# Make sure we don't do that for dynamic ARA reports.
|
# Make sure we don't do that for dynamic ARA reports.
|
||||||
RewriteCond %{REQUEST_URI} ^.*/<%= @ara_middleware_database_directory %> [NC]
|
RewriteCond %{REQUEST_URI} ^.*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %> [NC]
|
||||||
RewriteRule .* - [L]
|
RewriteRule .* - [L]
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
|||||||
Satisfy Any
|
Satisfy Any
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<% @readmes.each do |pattern, helpfile| -%>
|
<% scope.lookupvar('::openstackci::logserver::readmes').each do |pattern, helpfile| -%>
|
||||||
<Directory <%= @docroot %><%= pattern %>>
|
<Directory <%= @docroot %><%= pattern %>>
|
||||||
ReadmeName <%= helpfile %>
|
ReadmeName <%= helpfile %>
|
||||||
</Directory>
|
</Directory>
|
||||||
@ -78,7 +78,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
|||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
<% if @ara_middleware -%>
|
<% if scope.lookupvar('::openstackci::logserver::ara_middleware') -%>
|
||||||
<Directory "/usr/local/bin">
|
<Directory "/usr/local/bin">
|
||||||
<Files "ara-wsgi-sqlite">
|
<Files "ara-wsgi-sqlite">
|
||||||
Allow from all
|
Allow from all
|
||||||
@ -87,20 +87,20 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
|
|||||||
</Directory>
|
</Directory>
|
||||||
# ARA sqlite middleware configuration
|
# ARA sqlite middleware configuration
|
||||||
# See docs for details: https://ara.readthedocs.io/en/latest/advanced.html
|
# See docs for details: https://ara.readthedocs.io/en/latest/advanced.html
|
||||||
SetEnv ARA_WSGI_TMPDIR_MAX_AGE <%= @ara_middleware_tmpdir_max_age %>
|
SetEnv ARA_WSGI_TMPDIR_MAX_AGE <%= scope.lookupvar('::openstackci::logserver::ara_middleware_tmpdir_max_age') %>
|
||||||
SetEnv ARA_WSGI_LOG_ROOT <%= @docroot %>
|
SetEnv ARA_WSGI_LOG_ROOT <%= @docroot %>
|
||||||
SetEnv ARA_WSGI_DATABASE_DIRECTORY <%= @ara_middleware_database_directory %>
|
SetEnv ARA_WSGI_DATABASE_DIRECTORY <%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>
|
||||||
|
|
||||||
# Redirect .*/<%= @ara_middleware_database_directory %> to the ARA sqlite wsgi middleware
|
# Redirect .*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %> to the ARA sqlite wsgi middleware
|
||||||
# This middleware automatically loads the ARA web application with the
|
# This middleware automatically loads the ARA web application with the
|
||||||
# database located at .*/<%= @ara_middleware_database_directory %>/ansible.sqlite.
|
# database located at .*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>/ansible.sqlite.
|
||||||
# If we get a request directly to the database file, don't load the middleware
|
# If we get a request directly to the database file, don't load the middleware
|
||||||
# so that users can download the raw database if they wish.
|
# so that users can download the raw database if they wish.
|
||||||
WSGIScriptAliasMatch ^.*/<%= @ara_middleware_database_directory %>(?!/ansible.sqlite) /usr/local/bin/ara-wsgi-sqlite
|
WSGIScriptAliasMatch ^.*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %>(?!/ansible.sqlite) /usr/local/bin/ara-wsgi-sqlite
|
||||||
|
|
||||||
# Everything beyond this point is rewritten to htmlify.
|
# Everything beyond this point is rewritten to htmlify.
|
||||||
# Make sure we don't do that for dynamic ARA reports.
|
# Make sure we don't do that for dynamic ARA reports.
|
||||||
RewriteCond %{REQUEST_URI} ^.*/<%= @ara_middleware_database_directory %> [NC]
|
RewriteCond %{REQUEST_URI} ^.*/<%= scope.lookupvar('::openstackci::logserver::ara_middleware_database_directory') %> [NC]
|
||||||
RewriteRule .* - [L]
|
RewriteRule .* - [L]
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user