diff --git a/doc/source/_exts/deliverables.py b/doc/source/_exts/deliverables.py index a7b830aff5..089f1f20d9 100644 --- a/doc/source/_exts/deliverables.py +++ b/doc/source/_exts/deliverables.py @@ -472,17 +472,25 @@ def build_finished(app, exception): if exception is not None: return + redirections = generate_constraints_redirections(_deliverables) rendered_output = app.builder.templates.render( 'htaccess', - dict(redirections=generate_constraints_redirections(_deliverables)) + dict(redirections=redirections) ) output_full_name = os.path.join(app.builder.outdir, '.htaccess') with open(output_full_name, "w") as f: f.write(rendered_output) LOG.info('Wrote Redirections to %s' % (output_full_name)) - # NOTE(tonyb): We want to output this here because we won't be able to - # get to it via http{,s} so this helps debugging. - LOG.debug(rendered_output) + + rendered_output = app.builder.templates.render( + 'redirect-tests', + dict(redirections=redirections) + ) + output_full_name = os.path.join(app.builder.outdir, + '..', + 'redirect-tests.txt') + with open(output_full_name, "w") as f: + f.write(rendered_output) def setup(app): diff --git a/doc/source/_templates/redirect-tests b/doc/source/_templates/redirect-tests new file mode 100644 index 0000000000..f7203cc4a8 --- /dev/null +++ b/doc/source/_templates/redirect-tests @@ -0,0 +1,5 @@ +/teams/shade.html 301 /teams/openstacksdk.html +/constraints/upper/master 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master +{%- for redirection in redirections %} +/constraints/upper/{{ redirection.src }} {{ redirection.code }} http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h={{ redirection.dst }} +{%- endfor %} diff --git a/doc/test/redirect-tests.txt b/doc/test/redirect-tests.txt deleted file mode 100644 index 38822ec821..0000000000 --- a/doc/test/redirect-tests.txt +++ /dev/null @@ -1,12 +0,0 @@ -/teams/shade.html 301 /teams/openstacksdk.html -/constraints/upper/master 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master -/constraints/upper/stein 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master -/constraints/upper/rocky 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky -/constraints/upper/queens 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/queens -/constraints/upper/pike 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike -/constraints/upper/ocata 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata -/constraints/upper/newton 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton -/constraints/upper/mitaka 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=mitaka-eol -/constraints/upper/liberty 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=liberty-eol -/constraints/upper/kilo 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=kilo-eol -/constraints/upper/juno 301 http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=juno-eol diff --git a/tox.ini b/tox.ini index 4541b61f6f..2ee4607343 100644 --- a/tox.ini +++ b/tox.ini @@ -74,7 +74,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -v -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html - whereto {toxinidir}/doc/build/html/.htaccess {toxinidir}/doc/test/redirect-tests.txt + whereto {toxinidir}/doc/build/html/.htaccess {toxinidir}/doc/build/redirect-tests.txt [flake8] # E123, E125 skipped as they are invalid PEP-8.