diff options
author | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2016-10-12 16:42:35 +0200 |
---|---|---|
committer | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2016-11-15 15:35:15 +0100 |
commit | 9f8aff6636e0d86834178b461802f3e7cb95189d (patch) | |
tree | 3bbfec85cda9774295b5f30f8417ee36e512368d /build/f_repos/patch/fuel-mirror | |
parent | 38579142c683dbf26a6560d53d900111f4df4f6b (diff) |
Uplift to Fuel 10.0/Newton
Build working, automated deploy working (simple test cases only).
All plugins disabled, so is the generation of the local ISO cache.
Both need to be re-enabled after merge of this uplift.
All patches wiped, pertinent ones need to be re-enabled after the
merge of this uplift.
Change-Id: I978a3d4ed25a45a4b88a6e35693baac597b162c2
Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'build/f_repos/patch/fuel-mirror')
-rw-r--r-- | build/f_repos/patch/fuel-mirror/0001-Fixed-handling-http-redirects.patch | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/build/f_repos/patch/fuel-mirror/0001-Fixed-handling-http-redirects.patch b/build/f_repos/patch/fuel-mirror/0001-Fixed-handling-http-redirects.patch deleted file mode 100644 index b82be1128..000000000 --- a/build/f_repos/patch/fuel-mirror/0001-Fixed-handling-http-redirects.patch +++ /dev/null @@ -1,87 +0,0 @@ -From: Bulat Gaifullin <bgaifullin@mirantis.com> -Date: Fri, 24 Jun 2016 15:52:41 +0200 -Subject: [PATCH] Fixed handling http redirects - -Override method 'redirect_request' for patching -new request, that has been created on handling -http redirect. - -Change-Id: I40db406e2377bebec1113639b91a0b5262e2e9ad -Closes-Bug: 1593674 -(cherry picked from commit 192a3d9f8f993afb12c5108dd9339c6688c23e11) ---- - packetary/library/connections.py | 21 ++++++++++++++++++++- - packetary/tests/test_connections.py | 19 +++++++++++++++++++ - 2 files changed, 39 insertions(+), 1 deletion(-) - -diff --git a/packetary/library/connections.py b/packetary/library/connections.py -index 36a7a84..49b6c9b 100644 ---- a/packetary/library/connections.py -+++ b/packetary/library/connections.py -@@ -93,9 +93,23 @@ class ResumableResponse(StreamWrapper): - self.stream = response.stream - - --class RetryHandler(urllib.BaseHandler): -+class RetryHandler(urllib.HTTPRedirectHandler): - """urllib Handler to add ability for retrying on server errors.""" - -+ def redirect_request(self, req, fp, code, msg, headers, newurl): -+ new_req = urllib.HTTPRedirectHandler.redirect_request( -+ self, req, fp, code, msg, headers, newurl -+ ) -+ if new_req is not None: -+ # We use class assignment for casting new request to type -+ # RetryableRequest -+ new_req.__class__ = RetryableRequest -+ new_req.retries_left = req.retries_left -+ new_req.offset = req.offset -+ new_req.start_time = req.start_time -+ new_req.retry_interval = req.retry_interval -+ return new_req -+ - @staticmethod - def http_request(request): - """Initialises http request. -@@ -118,6 +132,11 @@ class RetryHandler(urllib.BaseHandler): - :return: ResumableResponse if success otherwise same response - """ - code, msg = response.getcode(), response.msg -+ -+ if 300 <= code < 400: -+ # the redirect group, pass to next handler as is -+ return response -+ - # the server should response partial content if range is specified - if request.offset > 0 and code != 206: - raise RangeError(msg) -diff --git a/packetary/tests/test_connections.py b/packetary/tests/test_connections.py -index a2621c8..c80b03d 100644 ---- a/packetary/tests/test_connections.py -+++ b/packetary/tests/test_connections.py -@@ -268,6 +268,25 @@ class TestRetryHandler(base.TestCase): - self.handler.http_response(request, response_mock) - self.handler.parent.open.assert_called_once_with(request) - -+ @mock.patch( -+ 'packetary.library.connections.urllib.' -+ 'HTTPRedirectHandler.redirect_request' -+ ) -+ def test_redirect_request(self, redirect_mock, _): -+ redirect_mock.return_value = connections.urllib.Request( -+ 'http://localhost/' -+ ) -+ req = mock.MagicMock(retries_left=10, retry_interval=5, offset=100) -+ new_req = self.handler.redirect_request(req, -1, 301, "", {}, "") -+ self.assertIsInstance(new_req, connections.RetryableRequest) -+ self.assertEqual(req.retries_left, new_req.retries_left) -+ self.assertEqual(req.retry_interval, new_req.retry_interval) -+ self.assertEqual(req.offset, new_req.offset) -+ redirect_mock.return_value = None -+ self.assertIsNone( -+ self.handler.redirect_request(req, -1, 301, "", {}, "") -+ ) -+ - - class TestResumeableResponse(base.TestCase): - def setUp(self): |