move settings about the released series to template generator

Move the setting for the released and in-development series to the
template generator so that we only have to track that information in
one place.

Change-Id: Ibd66e3ca9dea7451647b8d8289f0f9c11c002477
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-07-18 18:40:06 -04:00
parent 987b7aaf5c
commit b88b95bd53
2 changed files with 29 additions and 8 deletions

View File

@ -27,8 +27,25 @@ import requests
import yaml
SERIES_PAT = re.compile('^(mitaka|newton|ocata|pike|queens|rocky)/')
LATEST_SERIES = 'pike'
PAST_SERIES = [
'kilo',
'liberty',
'mitaka',
'newton',
]
RELEASED_SERIES = 'ocata'
SERIES_IN_DEVELOPMENT = 'pike'
FUTURE_SERIES = [
'queens',
'rocky',
]
ALL_SERIES = (
PAST_SERIES +
[RELEASED_SERIES, SERIES_IN_DEVELOPMENT] +
FUTURE_SERIES
)
SERIES_PAT = re.compile('^(' + '|'.join(ALL_SERIES) + ')/')
def initialize_logging(debug, verbose):
@ -265,7 +282,7 @@ def render_template(environment, project_data, regular_repos, infra_repos,
series_match = SERIES_PAT.match(template_file)
if series_match:
series = series_match.groups()[0]
if series == LATEST_SERIES:
if series == SERIES_IN_DEVELOPMENT:
series = 'latest'
else:
series = None
@ -284,6 +301,9 @@ def render_template(environment, project_data, regular_repos, infra_repos,
TEMPLATE_FILE=template_file,
REGULAR_REPOS=regular_repos,
INFRA_REPOS=infra_repos,
ALL_SERIES=ALL_SERIES,
RELEASED_SERIES=RELEASED_SERIES,
SERIES_IN_DEVELOPMENT=SERIES_IN_DEVELOPMENT,
topdir=topdir,
scriptdir=scriptdir,
cssdir=cssdir,

View File

@ -1,13 +1,14 @@
{# NOTE(dhellmann): This file is not in a series directory,
so we need to set the series name ourselves. #}
{% set series = 'latest' %}
{% set released_series = 'ocata' %}{# The most recently released series #}
{% set projects = PROJECT_DATA[series] %}
# Redirect old top-level HTML pages to the version under most recent
# full release.
redirectmatch 301 /$ /{{released_series}}/
redirectmatch 301 /index.html$ /{{released_series}}/
redirectmatch 301 /openstack-projects.html$ /{{released_series}}/projects.html
redirectmatch 301 /language-bindings.html$ /{{released_series}}/language-bindings.html
redirectmatch 301 /$ /{{RELEASED_SERIES}}/
redirectmatch 301 /index.html$ /{{RELEASED_SERIES}}/
redirectmatch 301 /openstack-projects.html$ /{{RELEASED_SERIES}}/projects.html
redirectmatch 301 /language-bindings.html$ /{{RELEASED_SERIES}}/language-bindings.html
# Redirecting End-of-Life (EOL) versions, see https://wiki.openstack.org/wiki/Releases:
redirectmatch 301 /bexar/.*$ /index.html