diff -Nru libcloud-3.4.1/debian/changelog libcloud-3.4.1/debian/changelog --- libcloud-3.4.1/debian/changelog 2021-12-29 08:43:06.000000000 +0100 +++ libcloud-3.4.1/debian/changelog 2022-05-11 15:51:43.000000000 +0200 @@ -1,3 +1,11 @@ +libcloud (3.4.1-2ubuntu1) kinetic; urgency=medium + + * Disable test that requires access to the Internet. + * Applied patches forwarded upstream to fix failures when HTTP proxy + variables are set (LP: #1972888) + + -- Olivier Gayot Wed, 11 May 2022 15:51:43 +0200 + libcloud (3.4.1-2) unstable; urgency=medium * Team upload. diff -Nru libcloud-3.4.1/debian/control libcloud-3.4.1/debian/control --- libcloud-3.4.1/debian/control 2021-12-23 18:08:20.000000000 +0100 +++ libcloud-3.4.1/debian/control 2022-05-11 15:51:43.000000000 +0200 @@ -1,7 +1,8 @@ Source: libcloud Section: python Priority: optional -Maintainer: Debian Python Team +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Python Team Uploaders: Soren Hansen , Hans-Christoph Steiner , diff -Nru libcloud-3.4.1/debian/patches/43b71091ebd159570302b695f0a244f4d0a7e497.patch libcloud-3.4.1/debian/patches/43b71091ebd159570302b695f0a244f4d0a7e497.patch --- libcloud-3.4.1/debian/patches/43b71091ebd159570302b695f0a244f4d0a7e497.patch 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/43b71091ebd159570302b695f0a244f4d0a7e497.patch 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,50 @@ +Description: stop HTTP server (thread) properly + test/test_http.py: stop HTTP server (thread) properly + + The HttpLayerTestCase test class creates a HTTPServer instance and runs + it in a separate thread. + + After running all the test-cases, we attempt to close the server and the + thread by killing the thread. Unfortunately, the code that does that is + unreachable because the tear-down member function is called tearDownCls + intead of tearDownClass. + + Moreover, there is no threading.Thread.kill function. This was undetected + because the code was unreachable. + + The proper way to clean things up is to: + + 1. Stop the HTTP server using HTTPServer.shutdown() + 2. Release the resources using HTTPServer.server_close() + 3. Join the thread using threading.Thread.join() + + The original patch from upstream was missing the call to + HTTPServer.server_close(), which was added later. + + This patch is not strictly necessary to fix the tests but subsequent patches + depend on tearDownClass being spelled properly. +Author: Olivier Gayot +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1972888 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010881 +Forwarded: https://github.com/apache/libcloud/pull/1690 +Applied-Upstream: https://github.com/apache/libcloud/pull/1690/commits/43b71091ebd159570302b695f0a244f4d0a7e497 +Last-Update: 2022-05-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/libcloud/test/test_http.py +=================================================================== +--- a/libcloud/test/test_http.py 2022-05-11 17:11:36.733859740 +0200 ++++ b/libcloud/test/test_http.py 2022-05-11 17:11:36.729859732 +0200 +@@ -116,8 +116,10 @@ + cls.mock_server_thread.start() + + @classmethod +- def tearDownCls(cls): +- cls.mock_server_thread.kill() ++ def tearDownClass(cls): ++ cls.mock_server.shutdown() ++ cls.mock_server.server_close() ++ cls.mock_server_thread.join() + + def test_prepared_request_empty_body_chunked_encoding_not_used(self): + connection = LibcloudConnection(host=self.listen_host, port=self.listen_port) diff -Nru libcloud-3.4.1/debian/patches/83bd562337abdda4b1ba6706999b13aa358bdd28.patch libcloud-3.4.1/debian/patches/83bd562337abdda4b1ba6706999b13aa358bdd28.patch --- libcloud-3.4.1/debian/patches/83bd562337abdda4b1ba6706999b13aa358bdd28.patch 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/83bd562337abdda4b1ba6706999b13aa358bdd28.patch 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,47 @@ +Description: test/test_http.py: also backup/restore HTTP proxy settings + + The HttpLayerTestCase class relies on the LibcloudConnection class - + which honors https_proxy and http_proxy variables. + + Since the tests expect connections to the loopback interface (e.g., + 127.0.0.1), we need to clear the http_proxy and https_proxy + variables before running the tests. Later on, we need to restore the + variables just like we did in test/test_connection.py +Author: Olivier Gayot +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1972888 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010881 +Forwarded: https://github.com/apache/libcloud/pull/1692 +Applied-Upstream: https://github.com/apache/libcloud/commit/83bd562337abdda4b1ba6706999b13aa358bdd28 +Last-Update: 2022-05-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/libcloud/test/test_http.py +=================================================================== +--- a/libcloud/test/test_http.py 2022-05-11 17:11:36.729859732 +0200 ++++ b/libcloud/test/test_http.py 2022-05-11 17:14:49.406276318 +0200 +@@ -115,12 +115,25 @@ + cls.mock_server_thread.setDaemon(True) + cls.mock_server_thread.start() + ++ cls.orig_http_proxy = os.environ.pop("http_proxy", None) ++ cls.orig_https_proxy = os.environ.pop("https_proxy", None) ++ + @classmethod + def tearDownClass(cls): + cls.mock_server.shutdown() + cls.mock_server.server_close() + cls.mock_server_thread.join() + ++ if cls.orig_http_proxy: ++ os.environ["http_proxy"] = cls.orig_http_proxy ++ elif "http_proxy" in os.environ: ++ del os.environ["http_proxy"] ++ ++ if cls.orig_https_proxy: ++ os.environ["https_proxy"] = cls.orig_https_proxy ++ elif "https_proxy" in os.environ: ++ del os.environ["https_proxy"] ++ + def test_prepared_request_empty_body_chunked_encoding_not_used(self): + connection = LibcloudConnection(host=self.listen_host, port=self.listen_port) + connection.prepared_request(method='GET', url='/test/prepared-request-1', body='', stream=True) diff -Nru libcloud-3.4.1/debian/patches/950e2a57a17c796264b647fd08353dd2e57d42ae.patch libcloud-3.4.1/debian/patches/950e2a57a17c796264b647fd08353dd2e57d42ae.patch --- libcloud-3.4.1/debian/patches/950e2a57a17c796264b647fd08353dd2e57d42ae.patch 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/950e2a57a17c796264b647fd08353dd2e57d42ae.patch 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,42 @@ +Description: test/test_connection.py: do not clear http_proxy unconditionally + The tearDownClass function from BaseConnectionClassTestCase used to + clear the http_proxy environment variable unconditionally. This can have + unexpected side effects since subsequent tests run with no http_proxy + set even if it was inherited from the environment when pytest was + started. + + Also, the http_proxy variable is already restored to its saved value (or + cleared if there was no value to save) in the tearDown function after + each test is executed, so there seems to be no reason to attempt to + clear it again. + + Likewise, the libcloud.common.base.ALLOW_PATH_DOUBLE_SLASHES variable is + already reset to False after each test is executed so there is no reason + to set it to False again after all tests from the TestCase have + executed. +Author: Olivier Gayot +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1972888 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010881 +Forwarded: https://github.com/apache/libcloud/pull/1692 +Applied-Upstream: https://github.com/apache/libcloud/commit/950e2a57a17c796264b647fd08353dd2e57d42ae +Last-Update: 2022-05-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/libcloud/test/test_connection.py +=================================================================== +--- a/libcloud/test/test_connection.py 2022-05-11 15:54:57.283262641 +0200 ++++ b/libcloud/test/test_connection.py 2022-05-11 15:55:18.027343574 +0200 +@@ -52,13 +52,6 @@ + + libcloud.common.base.ALLOW_PATH_DOUBLE_SLASHES = False + +- @classmethod +- def tearDownClass(cls): +- if 'http_proxy' in os.environ: +- del os.environ['http_proxy'] +- +- libcloud.common.base.ALLOW_PATH_DOUBLE_SLASHES = False +- + def test_parse_proxy_url(self): + conn = LibcloudBaseConnection() + diff -Nru libcloud-3.4.1/debian/patches/95753dadf64128f10b75c07b9944d04101ad89b8.patch libcloud-3.4.1/debian/patches/95753dadf64128f10b75c07b9944d04101ad89b8.patch --- libcloud-3.4.1/debian/patches/95753dadf64128f10b75c07b9944d04101ad89b8.patch 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/95753dadf64128f10b75c07b9944d04101ad89b8.patch 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,55 @@ +Description: test/test_connection.py: allow tests to run if https_proxy is set + We have code in setUp & tearDown functions to make tests run properly if + the http_proxy variable is already present in the environment when + running tests. + + The code backs up the http_proxy variable, clears it, and restores it + after the tests have run. + + However, we would also need to handle the HTTPS counterpart, the + https_proxy variable. Running tests with this variable set currently + fails with: + + self.assertIsNone(conn.proxy_scheme) + E AssertionError: 'http' is not None + + libcloud/test/test_connection.py:127: AssertionError + + This patch adds the same logic that we have for HTTP, but for the HTTPS + counterpart. +Author: Olivier Gayot +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1972888 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010881 +Forwarded: https://github.com/apache/libcloud/pull/1692 +Applied-Upstream: https://github.com/apache/libcloud/commit/95753dadf64128f10b75c07b9944d04101ad89b8 +Last-Update: 2022-05-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/libcloud/test/test_connection.py +=================================================================== +--- a/libcloud/test/test_connection.py 2022-05-11 17:11:20.405830655 +0200 ++++ b/libcloud/test/test_connection.py 2022-05-11 17:11:20.401830648 +0200 +@@ -42,14 +42,20 @@ + class BaseConnectionClassTestCase(unittest.TestCase): + + def setUp(self): +- self.orig_proxy = os.environ.pop('http_proxy', None) ++ self.orig_http_proxy = os.environ.pop("http_proxy", None) ++ self.orig_https_proxy = os.environ.pop("https_proxy", None) + + def tearDown(self): +- if self.orig_proxy: +- os.environ['http_proxy'] = self.orig_proxy ++ if self.orig_http_proxy: ++ os.environ["http_proxy"] = self.orig_http_proxy + elif 'http_proxy' in os.environ: + del os.environ['http_proxy'] + ++ if self.orig_https_proxy: ++ os.environ["https_proxy"] = self.orig_https_proxy ++ elif "https_proxy" in os.environ: ++ del os.environ["https_proxy"] ++ + libcloud.common.base.ALLOW_PATH_DOUBLE_SLASHES = False + + def test_parse_proxy_url(self): diff -Nru libcloud-3.4.1/debian/patches/disable-online-test.patch libcloud-3.4.1/debian/patches/disable-online-test.patch --- libcloud-3.4.1/debian/patches/disable-online-test.patch 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/disable-online-test.patch 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,29 @@ +Description: Disable tests that require to be online +Author: Olivier Gayot +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcloud/+bug/1972888 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010881 +Forwarded: not-needed +Last-Update: 2022-05-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: b/libcloud/test/compute/test_ovh.py +=================================================================== +--- a/libcloud/test/compute/test_ovh.py 2022-05-11 17:11:46.085876879 +0200 ++++ b/libcloud/test/compute/test_ovh.py 2022-05-11 17:11:46.081876871 +0200 +@@ -16,6 +16,8 @@ + import unittest + from mock import patch + ++import pytest ++ + from libcloud.utils.py3 import httplib + from libcloud.common.exceptions import BaseHTTPError + from libcloud.http import LibcloudConnection +@@ -162,6 +164,7 @@ + driver = OvhNodeDriver(*OVH_PARAMS, region='ca') + self.assertEqual(driver.connection.host, 'ca.api.ovh.com') + ++ @pytest.mark.skip("Requires access to the Internet") + def test_list_nodes_invalid_region(self): + OvhNodeDriver.connectionCls.conn_class = LibcloudConnection + driver = OvhNodeDriver(*OVH_PARAMS, region='invalid') diff -Nru libcloud-3.4.1/debian/patches/series libcloud-3.4.1/debian/patches/series --- libcloud-3.4.1/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ libcloud-3.4.1/debian/patches/series 2022-05-11 15:51:43.000000000 +0200 @@ -0,0 +1,5 @@ +950e2a57a17c796264b647fd08353dd2e57d42ae.patch +95753dadf64128f10b75c07b9944d04101ad89b8.patch +43b71091ebd159570302b695f0a244f4d0a7e497.patch +83bd562337abdda4b1ba6706999b13aa358bdd28.patch +disable-online-test.patch