From e392f0bd481d1b78f54d23faa8ce62894be1e3b9 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 3 Oct 2019 13:58:21 -0700 Subject: [PATCH] Redirects to master should always be temporary We *know* that requirements will have a stable/train branch soon; make sure clients don't go caching the redirect to master. Change-Id: I8507d86e4f553b698163be61665267d42e033d91 Related-Change: Ia2e8c46c27ac97217576afdd1677efba4b99fc37 --- openstack_releases/_redirections.py | 3 ++- openstack_releases/tests/test_redirections.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openstack_releases/_redirections.py b/openstack_releases/_redirections.py index a94d4c8cbb..a57e9a7738 100644 --- a/openstack_releases/_redirections.py +++ b/openstack_releases/_redirections.py @@ -41,7 +41,8 @@ def generate_constraints_redirections(_deliverables, future_releases=[]): # Insert into the begining of the list so that redirections are # master -> juno - redirections.insert(0, dict(code=301, src=deliv.series, + status = 302 if target == 'master' else 301 + redirections.insert(0, dict(code=status, src=deliv.series, ref_type=ref_type, dst=target)) for series in future_releases: diff --git a/openstack_releases/tests/test_redirections.py b/openstack_releases/tests/test_redirections.py index b778100e46..4bd904148f 100644 --- a/openstack_releases/tests/test_redirections.py +++ b/openstack_releases/tests/test_redirections.py @@ -122,7 +122,7 @@ class TestRedirections(base.BaseTestCase): deliverables = FakeDeliverables([ self.OPEN_DEVELOPMENT, ]) - self.assertEqual([dict(code=301, src='stein', ref_type='branch', + self.assertEqual([dict(code=302, src='stein', ref_type='branch', dst='master')], generate_constraints_redirections(deliverables)) @@ -130,7 +130,7 @@ class TestRedirections(base.BaseTestCase): deliverables = FakeDeliverables([ self.DEVELOPMENT_RELEASE, ]) - self.assertEqual([dict(code=301, src='stein', ref_type='branch', + self.assertEqual([dict(code=302, src='stein', ref_type='branch', dst='master')], generate_constraints_redirections(deliverables)) @@ -172,7 +172,7 @@ class TestRedirections(base.BaseTestCase): self.STABLE_RELEASE, self.DEVELOPMENT_RELEASE, ]) - self.assertEqual([dict(code=301, src='stein', ref_type='branch', + self.assertEqual([dict(code=302, src='stein', ref_type='branch', dst='master'), dict(code=301, src='rocky', ref_type='branch', dst='stable/rocky'),