Add election alias to governance.openstack.org

Add an alias for /election/ to go to /srv/static/election where
the election repo will be published to.

Partially-Implements: spec publish-election-repo
Change-Id: Ie5e783c65396e9fb74f3d739e775e51a948652fe
This commit is contained in:
Joshua Hesketh
2016-03-15 12:45:22 +11:00
parent f73fc067cb
commit 91dcb510ba
2 changed files with 48 additions and 8 deletions

View File

@@ -49,6 +49,10 @@ class openstack_project::static (
} }
} }
if ! defined(Httpd::Mod['alias']) {
httpd::mod { 'alias': ensure => present }
}
if ! defined(File['/srv/static']) { if ! defined(File['/srv/static']) {
file { '/srv/static': file { '/srv/static':
ensure => directory, ensure => directory,
@@ -252,22 +256,39 @@ class openstack_project::static (
} }
########################################################### ###########################################################
# Governance # Governance & Election
# Extra aliases and directories needed for vhost template:
$aliases = {
'/election/' => '/srv/static/election/'
}
$directories = [
'/srv/static/election',
'/srv/static/governance'
]
::httpd::vhost { 'governance.openstack.org': ::httpd::vhost { 'governance.openstack.org':
port => 443, # Is required despite not being used. port => 443, # Is required despite not being used.
docroot => '/srv/static/governance', docroot => '/srv/static/governance',
priority => '50', priority => '50',
ssl => true, ssl => true,
template => 'openstack_project/static-http-and-https.vhost.erb', template => 'openstack_project/static-http-and-https.vhost.erb',
vhost_name => 'governance.openstack.org', vhost_name => 'governance.openstack.org',
require => [ require => [
File['/srv/static/election'],
File['/srv/static/governance'], File['/srv/static/governance'],
File[$cert_file], File[$cert_file],
File[$key_file], File[$key_file],
], ],
} }
file { '/srv/static/election':
ensure => directory,
owner => 'jenkins',
group => 'jenkins',
require => User['jenkins'],
}
file { '/srv/static/governance': file { '/srv/static/governance':
ensure => directory, ensure => directory,
owner => 'jenkins', owner => 'jenkins',

View File

@@ -14,6 +14,24 @@
RewriteRule ^/(.*)$ http://<%= @vhost_name %>/$1 [L,R=301] RewriteRule ^/(.*)$ http://<%= @vhost_name %>/$1 [L,R=301]
<% end -%> <% end -%>
DocumentRoot <%= @docroot %> DocumentRoot <%= @docroot %>
<% if scope.lookupvar('openstack_project::static::aliases').is_a? Hash -%>
# Alias other folders
<% scope.lookupvar('openstack_project::static::aliases').each do |a, d| -%>
Alias "<%= a %>" "<%= d %>"
<% end -%>
<% end -%>
<% if scope.lookupvar('openstack_project::static::directories').is_a? Array -%>
<% scope.lookupvar('openstack_project::static::directories').each do |dirname| -%>
<Directory <%= dirname %>>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Satisfy Any
</Directory>
<% end -%>
<% else -%>
<Directory <%= @docroot %>> <Directory <%= @docroot %>>
Options Indexes FollowSymLinks MultiViews Options Indexes FollowSymLinks MultiViews
AllowOverride None AllowOverride None
@@ -21,6 +39,7 @@
allow from all allow from all
Satisfy Any Satisfy Any
</Directory> </Directory>
<% end -%>
LogLevel warn LogLevel warn
ErrorLog /var/log/apache2/<%= @vhost_name %>_error.log ErrorLog /var/log/apache2/<%= @vhost_name %>_error.log
CustomLog /var/log/apache2/<%= @vhost_name %>_access.log combined CustomLog /var/log/apache2/<%= @vhost_name %>_access.log combined