build the redirects for the project-deploy-guide dynamically

Pass the list of maintained series to the template environment so we
can use that list to generate all of the redirects to the
project deploy guide pages instead of having to update the list of
series in two places.

The newton series is handled as a special case because it exists but
is not considered maintained.

Change-Id: I10794819260f1edd54e3711258ab715910ccf20f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-08-30 09:13:34 -04:00
parent 43e8716196
commit 1916056405
3 changed files with 16 additions and 8 deletions

View File

@ -70,12 +70,15 @@ PAST_SERIES = [
if info.status != 'development'
]
# Find the most recently released series.
RELEASED_SERIES = [
# Find the currently maintained series.
MAINTAINED_SERIES = [
name
for name, info in sorted(SERIES_INFO.items())
if info.status == 'maintained'
][-1]
]
# Find the most recently released series.
RELEASED_SERIES = MAINTAINED_SERIES[-1]
# Find the series being developed.
SERIES_IN_DEVELOPMENT = [
@ -436,6 +439,7 @@ def render_template(environment, project_data, regular_repos, infra_repos,
ALL_SERIES=ALL_SERIES,
PAST_SERIES=PAST_SERIES,
RELEASED_SERIES=RELEASED_SERIES,
MAINTAINED_SERIES=MAINTAINED_SERIES,
SERIES_IN_DEVELOPMENT=SERIES_IN_DEVELOPMENT,
TOPDIR=topdir,
SCRIPTDIR=scriptdir,

View File

@ -151,7 +151,11 @@ redirect 301 /doc-contrib-guide/ui-text-guidelines.html /doc-contrib-guide/ux-ui
redirect 301 /doc-contrib-guide/ui-text-guidelines /doc-contrib-guide/ux-ui-guidelines
# Redirect deploy guides to their branch index.
{{ dir_to_page('/project-deploy-guide/(newton|ocata|pike|queens|rocky)', '/$1/deploy/') }}
{# newton is a special case because it exists but is not maintained #}
{{ dir_to_page('/project-deploy-guide/(newton)', '/$1/deploy/') }}
{% for series in MAINTAINED_SERIES %}
{{ dir_to_page('/project-deploy-guide/(' + series + ')', '/$1/deploy/') }}
{% endfor %}
# Redirect any deploy guide project directory back to the current stable index
{{ path_to_released_series('/project-deploy-guide/?$', '/deploy/') }}

View File

@ -170,11 +170,11 @@
# Redirect any deploy guide project directory back to the current stable index
{{ dir_to_page('/project-deploy-guide', '/' + RELEASED_SERIES + '/deploy/') }}
# Redirect all the project deploy folders to their appropriate branch
{# newton is a special case because it exists but is not maintained #}
{{ dir_to_page('/project-deploy-guide/newton', '/newton/deploy/') }}
{{ dir_to_page('/project-deploy-guide/ocata', '/ocata/deploy/') }}
{{ dir_to_page('/project-deploy-guide/pike', '/pike/deploy/') }}
{{ dir_to_page('/project-deploy-guide/queens', '/queens/deploy/') }}
{{ dir_to_page('/project-deploy-guide/rocky', '/rocky/deploy/') }}
{% for series in MAINTAINED_SERIES %}
{{ dir_to_page('/project-deploy-guide/' + series, '/' + series + '/deploy/') }}
{% endfor %}
# Ensure each project's deloy guide is reachable.
/project-deploy-guide/openstack-ansible/latest/ 200
/project-deploy-guide/openstack-ansible/pike/ 200