openstack-manuals/www/redirect-tests.txt
Frank Kloeker 7b6b2b5214 Redirect missing project page for openstack-charms
Link is required for the project navigator

Change-Id: Iaf0718b56505927860081bb2504cc9fcc5bada52
2019-05-03 16:54:07 +02:00

280 lines
12 KiB
Plaintext

{# NOTE(dhellmann): This file is not in a series directory,
so we need to set the series name ourselves. #}
{% set series = 'latest' %}
{% set projects = PROJECT_DATA[series] %}
{# Macro to generate tests for a specific directory to a
given page, allowing the path to not have a trailing slash.
Arguments:
path -- the partial regex representing the input path (should not end in /)
result -- the result pattern
code -- the response code (defaults to 301)
#}
{% macro dir_to_page(path, result, code=301) -%}
{{ path }} {{ code }} {{ result }}
{{ path }}/ {{ code }} {{ result }}
{%- endmacro %}
{# Macro to generate tests for anything under a given path to a
given page, allowing the path to not have a trailing slash.
Arguments:
path -- the partial regex representing the input path (should not end in /)
result -- the result pattern
code -- the response code (defaults to 301)
#}
{% macro path_to_page(path, result, code=301) -%}
{{ dir_to_page(path, result, code) }}
{{ path }}/any-page {{ code }} {{ result }}
{{ path }}/any-page.html {{ code }} {{ result }}
{%- endmacro %}
{# Macro to generate redirects for a given path to a location under
the RELEASED_SERIES. The result argument should be the sub-directory
under RELEASED_SERIES.
Arguments:
path -- the partial regex representing the input path (should not end in /)
result -- the subdirectory under /RELEASED_SERIES, (should start with /)
code -- the response code (defaults to 301)
#}
{% macro path_to_released_series(path, result, code=301) -%}
{{ path_to_page(path, '/' + RELEASED_SERIES + result, code) }}
{%- endmacro %}
{# Macro to generate tests for deep links under a page.
A trailing catch-all pattern is appended and can be referenced in
the result value.
Arguments:
path -- the partial regex representing the input path (should not end in /)
result_prefix -- the start of the new path (should not include /)
code -- the response code (defaults to 301)
#}
{% macro deep_links(path, result_prefix, code=301, nosuffix=True) -%}
{{ path }} {{ code }} {{ result_prefix }}/
{{ path }}/ {{ code }} {{ result_prefix }}/
{{ path }}/any-page {{ code }} {{ result_prefix }}/any-page
{{ path }}/any-page.html {{ code }} {{ result_prefix }}/any-page.html
{%- if nosuffix %}
{{ path }}suffix 200
{{ path }}suffix/ 200
{{ path }}suffix/any-page 200
{{ path }}suffix/any-page.html 200
{% endif -%}
{%- endmacro %}
{# Macro to handle project renames.
Arguments:
old -- The previous name of the project.
new -- The new name of the project.
#}
{% macro rename_project(old, new) -%}
{{ deep_links('/' + old, '/' + new) }}
{%- endmacro %}
# Redirect old top-level HTML pages to the version under most recent
# full release.
/ 301 /{{ RELEASED_SERIES }}/
/index.html 301 /{{ RELEASED_SERIES }}/
/openstack-projects.html 301 /{{ RELEASED_SERIES }}/projects.html
/language-bindings.html 301 /{{ RELEASED_SERIES }}/language-bindings.html
# Redirect docs.openstack.org index.html subpage pointers to main page
{{ dir_to_page('/install', '/' + RELEASED_SERIES + '/install/') }}
{{ dir_to_page('/basic-install', '/' + RELEASED_SERIES + '/install/') }}
{{ dir_to_page('/run', '/') }}
/developer/index.html 301 /{{ RELEASED_SERIES }}/projects.html
{{ dir_to_page('/cli', '/') }}
/api/api-specs.html 301 http://developer.openstack.org/api-guide/quick-start/index.html
# Redirect old Admin Guides to new landing page
{{ path_to_released_series('/admin-guide', '/admin/') }}
{{ path_to_released_series('/user-guide-admin', '/admin/') }}
# A doc generation bug resulted in Google indexing links containing "//", which cause
# problems with linked content (images/css/etc). This rule generates a 301 redirect
# for these links.
#
# details: https://bugs.launchpad.net/openstack-manuals/+bug/1288513
/a//b/ 301 /a/b/
# Redirect networking-guide since it is now versioned
{{ dir_to_page('/networking-guide', '/ocata/networking-guide/') }}
# Redirect old releases content to new location
{{ deep_links('/releases', 'http://releases.openstack.org') }}
# redirect all kuryr sub-repositories appropriately
{{ deep_links('/developer/kuryr-kubernetes', '/kuryr-kubernetes/latest') }}
{{ deep_links('/developer/kuryr-libnetwork', '/kuryr-libnetwork/latest') }}
{{ deep_links('/developer/kuryr-tempest-plugin', '/kuryr-tempest-plugin/latest') }}
# redirect all kolla sub-repositories appropriately
{{ deep_links('/developer/kolla-kubernetes', '/kolla-kubernetes/latest') }}
# Redirect all openstack-ansible repositories appropriately
{{ deep_links('/developer/ansible-hardening', '/ansible-hardening/latest') }}
{{ deep_links('/developer/openstack-ansible-foo', '/openstack-ansible-foo/latest', nosuffix=False) }}
# Redirect some tripleo repositories appropriately
{{ deep_links('/developer/tripleo-common', '/tripleo-common/latest') }}
{{ deep_links('/developer/tripleo-quickstart', '/tripleo-quickstart/latest') }}
{{ deep_links('/developer/tripleo-validations', '/tripleo-validations/latest') }}
# Redirect sahara repositories appropriately
{{ deep_links('/developer/sahara-tests', '/sahara-tests/latest') }}
# Redirect removed user guide
{{ path_to_released_series('/user-guide', '/user/') }}
# Redirect removed ops guide
{{ path_to_released_series('/ops-guide', '/admin/') }}
{{ path_to_released_series('/ops', '/admin/') }}
{{ path_to_released_series('/openstack-ops', '/admin/') }}
{{ path_to_released_series('/trunk/openstack-ops', '/admin/') }}
# Redirect api list
{{ path_to_released_series('/api', '/api/') }}
# Redirect missing project page for openstack-charms
{{ path_to_page('/openstack-charms', '/charm-guide/') }}
# Redirect old security index
{{ path_to_page('/sec', '/security-guide/') }}
{{ path_to_page('/security-guide/content', '/security-guide/') }}
# Redirect to series indexes
{{ path_to_page('/latest/configuration', '/' + SERIES_IN_DEVELOPMENT + '/configuration/') }}
{{ path_to_page('/latest/install', '/' + SERIES_IN_DEVELOPMENT + '/install/') }}
{{ path_to_released_series('/user', '/user/') }}
{{ path_to_page('/latest/user', '/' + SERIES_IN_DEVELOPMENT + '/user/') }}
{{ path_to_released_series('/admin', '/admin/') }}
{{ path_to_page('/latest/admin', '/' + SERIES_IN_DEVELOPMENT + '/admin/') }}
{{ dir_to_page('/latest', '/' + SERIES_IN_DEVELOPMENT + '/') }}
# Redirect some pages users search for
{{ path_to_page('/arch-design/content', '/arch-design/') }}
{{ path_to_page('/image-guide/content', '/image-guide/') }}
{{ path_to_released_series('/admin-guide-cloud', '/admin/') }}
{{ path_to_page('/trunk/openstack-compute', '/nova/latest/admin/') }}
/glossary/content/glossary.html 301 /doc-contrib-guide/common/glossary.html
{{ dir_to_page('/icehouse/training-guides', '/upstream-training/') }}
# Redirect changed directory name for the Contributor Guide
{{ deep_links('/contributor-guide', '/doc-contrib-guide') }}
# Redirect changed sub-directory name in the Contributor Guide
/doc-contrib-guide/ui-text-guidelines.html 301 /doc-contrib-guide/ux-ui-guidelines/ui-text-guidelines.html
/doc-contrib-guide/ui-text-guidelines 301 /doc-contrib-guide/ux-ui-guidelines
# 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/') }}
{% 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
/project-deploy-guide/openstack-ansible/ocata/ 200
/project-deploy-guide/openstack-ansible/newton/ 200
/project-deploy-guide/kolla-ansible/pike/ 200
/project-deploy-guide/kolla-ansible/ocata/ 200
# Redirect old install guide list pages to their new home
{{ path_to_page('/havana/install-guide', '/havana/') }}
{{ path_to_page('/icehouse/install-guide', '/icehouse/') }}
{{ path_to_page('/juno/install-guide', '/juno/') }}
{{ path_to_page('/kilo/install-guide', '/kilo/') }}
{{ path_to_page('/mitaka/install-guide', '/mitaka/') }}
{{ dir_to_page('/project-install-guide/newton', '/newton/install/') }}
{{ deep_links('/project-install-guide/ocata', '/ocata/install') }}
# Redirecting infra docs links to new location
{{ deep_links('/infra/shade', '/shade/latest') }}
# Redirecting old project developer docs to the new layout. If a
# project has an in-tree .htaccess file, assume it can handle the full
# path in the redirect. Otherwise, redirect everything to the new
# latest index.html.
{% for project in projects|sort(attribute='name') -%}
{%- if project.has_in_tree_htaccess %}
{{ deep_links('/developer/' + project.name, '/' + project.name + '/latest') }}
{% else %}
{{ path_to_page('/developer/' + project.name, '/' + project.name + '/latest/') }}
{% endif -%}
{%- endfor %}
# Redirect old cli-reference to the OSC latest docs
{{ path_to_page('/cli-reference', '/python-openstackclient/latest/') }}
# Redirects from service-type to code-name
{% for project in projects -%}
{%- if project.type == 'service' and project.service_type and (project.service_type|lower != project.name) %}
{{ path_to_page('/' + project.service_type|lower, '/' + project.name + '/latest/', code=302) }}
{%- endif %}
{%- endfor %}
# End service-type redirects
# Redirects from code-name without a series to latest
{% for repo in REGULAR_REPOS %}
{{ dir_to_page('/' + repo.base, '/' + repo.base + '/latest/') }}
{%- endfor %}
# End latest code-name redirects
# Redirects from infra code-name without a series to location
{% for repo in INFRA_REPOS %}
{{ dir_to_page('/' + repo.base, '/infra/' + repo.base + '/') }}
{%- endfor %}
# End infra code-name redirects
# Redirect https://docs.openstack.org/infra/zuul/feature/zuulv3/ to
# https://zuul-ci.org/docs/zuul
/infra/zuul/feature/zuulv3/user/config.html 301 https://zuul-ci.org/docs/zuul/user/config.html
/infra/zuul/feature/zuulv3/index.html 301 https://zuul-ci.org/docs/zuul/index.html
# End redirect zuul/feature/zuulv3
# Redirect zuul to zuul-ci.org
{{ deep_links('/infra/zuul', 'https://zuul-ci.org/docs/zuul') }}
# End redirect zuul to zuul-ci.org
# Redirect https://docs.openstack.org/infra/nodepool/feature/zuulv3/ to
# https://zuul-ci.org/docs/nodepool
/infra/nodepool/feature/zuulv3/index.html 301 https://zuul-ci.org/docs/nodepool/index.html
# End redirect nodepool/feature/zuulv3
# Redirect nodepool to zuul-ci.org
{{ deep_links('/infra/nodepool', 'https://zuul-ci.org/docs/nodepool') }}
# End redirect nodepool to zuul-ci.org
# Redirect zuul-base-jobs to zuul-ci.org
{{ deep_links('/infra/zuul-base-jobs', 'https://zuul-ci.org/docs/zuul-base-jobs') }}
# End redirect zuul-base-jobs to zuul-ci.org
# Redirect zuul-jobs to zuul-ci.org
{{ deep_links('/infra/zuul-jobs', 'https://zuul-ci.org/docs/zuul-jobs') }}
# End redirect zuul-jobs to zuul-ci.org
# Redirect zuul-sphinx to zuul-ci.org
{{ deep_links('/infra/zuul-sphinx', 'https://zuul-ci.org/docs/zuul-sphinx') }}
# End redirect zuul-sphinx to zuul-ci.org
# Redirect from python-openstacksdk to openstacksdk
{{ rename_project('python-openstacksdk', 'openstacksdk') }}
# End redirect for openstacksdk
# Redirect from monasca to monasca-api
{{ rename_project('monasca', 'monasca-api') }}
# End redirect for monasca-api
# Redirect outdated bare metal installation guide
{{ deep_links('/project-install-guide/baremetal/draft', '/ironic/latest/install') }}
# End redirect outdated bare metal installation guide