From 8c9c623b76c784209c7d1d806914e520eefae12b Mon Sep 17 00:00:00 2001 From: Peter Matulis Date: Tue, 5 Jan 2021 14:15:39 -0500 Subject: [PATCH] Redirect links for config-openstack Adds a redirect capabilities for the charm-deployment-guide for the config-openstack.html to configure-openstack.html renaming. This also adds whereto testing in order to validate and confirm that the redirect links are working as intended. Note, this will redirect the user from the config-openstack.html for any of the release names. This may result in a 404 not found if an older release is being accessed since the renaming/refactoring will not be backported. Co-Authored-By: Peter Matulis Co-Authored-By: Billy Olsen Change-Id: I61d2eabadd76c86fa63b49c6b7552bcb1ee20d67 --- deploy-guide/source/_extra/.htaccess | 3 ++- deploy-guide/test/redirect-tests.txt | 16 ++++++++++++++++ requirements.txt | 1 + tox.ini | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 deploy-guide/test/redirect-tests.txt diff --git a/deploy-guide/source/_extra/.htaccess b/deploy-guide/source/_extra/.htaccess index 7ac82c4..7505f32 100644 --- a/deploy-guide/source/_extra/.htaccess +++ b/deploy-guide/source/_extra/.htaccess @@ -1 +1,2 @@ -Redirect 301 /config-openstack.html /configure-openstack.html +# Redirects related to gerrit topic 'cdg-reorg' +RedirectMatch 301 ^/project-deploy-guide/charm-deployment-guide/([^/]+)/config-openstack.html /project-deploy-guide/charm-deployment-guide/$1/configure-openstack.html diff --git a/deploy-guide/test/redirect-tests.txt b/deploy-guide/test/redirect-tests.txt new file mode 100644 index 0000000..4134c20 --- /dev/null +++ b/deploy-guide/test/redirect-tests.txt @@ -0,0 +1,16 @@ +# This file contains tests for redirects to handle existing URLs for +# documentation that has been moved. See +# https://docs.openstack.org/whereto/latest/ for details. + +# No redirects +/ 200 +/project-deploy-guide 200 +/project-deploy-guide/charm-deployment-guide 200 +/some/other/project/config-openstack.html 200 +/project-deploy-guide/foo/config-openstack.html 200 + +# Refactoring docs moved config-openstack to configure-openstack +# Make sure new redirects work +/project-deploy-guide/charm-deployment-guide/victoria/config-openstack.html 301 /project-deploy-guide/charm-deployment-guide/victoria/configure-openstack.html +/project-deploy-guide/charm-deployment-guide/latest/config-openstack.html 301 /project-deploy-guide/charm-deployment-guide/latest/configure-openstack.html + diff --git a/requirements.txt b/requirements.txt index 4964b0c..62c3f92 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 sphinx>=2.0.0,!=2.1.0 # BSD openstackdocstheme>=2.2.1 # Apache-2.0 +whereto>=0.3.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 0ab5683..b89c5f3 100644 --- a/tox.ini +++ b/tox.ini @@ -13,3 +13,4 @@ commands = {posargs} [testenv:deploy-guide] commands = sphinx-build -a -W -d deploy-guide/build/doctrees -b html deploy-guide/source deploy-guide/build/html + whereto deploy-guide/source/_extra/.htaccess deploy-guide/test/redirect-tests.txt