diff -Nru python-pylxd-2.3.2~alpha1-422-10/debian/changelog python-pylxd-2.3.2~alpha1-426-10/debian/changelog --- python-pylxd-2.3.2~alpha1-422-10/debian/changelog 2023-02-14 00:02:06.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/debian/changelog 2023-02-14 14:54:06.000000000 +0000 @@ -1,8 +1,8 @@ -python-pylxd (2.3.2~alpha1-422-10-g.06fed20~ubuntu22.10.1) kinetic; urgency=low +python-pylxd (2.3.2~alpha1-426-10-g.9974257~ubuntu22.10.1) kinetic; urgency=low * Auto build. - -- Launchpad Package Builder Tue, 14 Feb 2023 00:02:06 +0000 + -- Launchpad Package Builder Tue, 14 Feb 2023 14:54:06 +0000 python-pylxd (2.3.2~alpha1-1) unstable; urgency=medium diff -Nru python-pylxd-2.3.2~alpha1-422-10/debian/git-build-recipe.manifest python-pylxd-2.3.2~alpha1-426-10/debian/git-build-recipe.manifest --- python-pylxd-2.3.2~alpha1-422-10/debian/git-build-recipe.manifest 2023-02-14 00:02:06.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/debian/git-build-recipe.manifest 2023-02-14 14:54:06.000000000 +0000 @@ -1,3 +1,3 @@ -# git-build-recipe format 0.4 deb-version {debupstream}-422-10-g.06fed20 -lp:~maas-committers/maas/+git/pylxd git-commit:06fed20c60f978a48628d3eeb6551be5e1aa344e +# git-build-recipe format 0.4 deb-version {debupstream}-426-10-g.9974257 +lp:~maas-committers/maas/+git/pylxd git-commit:9974257348ac5a64391591ecdbc6fbe891ad99fe nest-part packaging lp:~maas-committers/maas/+git/pylxd-packaging debian debian git-commit:abca207f95646caa0e5f0758ec34d44d6d93973e diff -Nru python-pylxd-2.3.2~alpha1-422-10/.github/workflows/ci.yml python-pylxd-2.3.2~alpha1-426-10/.github/workflows/ci.yml --- python-pylxd-2.3.2~alpha1-422-10/.github/workflows/ci.yml 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/.github/workflows/ci.yml 2023-02-14 14:53:42.000000000 +0000 @@ -10,16 +10,11 @@ jobs: lint-python: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Repository checkout uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.6" - - name: Install dependencies run: | pip install --upgrade pip tox @@ -29,7 +24,7 @@ tox -e lint lint-shell: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Repository checkout uses: actions/checkout@v3 @@ -43,11 +38,6 @@ - name: Repository checkout uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.6" - - name: Install dependencies run: | pip install --upgrade pip tox diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/client.py python-pylxd-2.3.2~alpha1-426-10/pylxd/client.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/client.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/client.py 2023-02-14 14:53:42.000000000 +0000 @@ -73,24 +73,40 @@ class _APINode: - """An api node object.""" + """An api node object. + + If `session` is given, it should be a + `requests{,_unixsocket}.Session` which is used for issuing requests. + + `cert` and `verify` options are set on the session, and should not + be given when `session` is given. + """ def __init__( - self, api_endpoint, cert=None, verify=True, timeout=None, project=None + self, + api_endpoint, + cert=None, + verify=True, + timeout=None, + project=None, + session=None, ): self._api_endpoint = api_endpoint self._timeout = timeout self._project = project - if self._api_endpoint.startswith("http+unix://"): - self.session = requests_unixsocket.Session() - else: - self.session = requests.Session() - self.session.cert = cert - self.session.verify = verify + if session is None: + if self._api_endpoint.startswith("http+unix://"): + self.session = requests_unixsocket.Session() + else: + self.session = requests.Session() + self.session.cert = cert + self.session.verify = verify - if isinstance(verify, str): - self.session.mount(api_endpoint, LXDSSLAdapter()) + if isinstance(verify, str): + self.session.mount(api_endpoint, LXDSSLAdapter()) + else: + self.session = session def __getattr__(self, name): """Converts attribute lookup into the next / of an api @@ -106,8 +122,7 @@ name = name.replace("_", "-") return self.__class__( "{}/{}".format(self._api_endpoint, name), - cert=self.session.cert, - verify=self.session.verify, + session=self.session, timeout=self._timeout, project=self._project, ) @@ -122,8 +137,7 @@ """ return self.__class__( "{}/{}".format(self._api_endpoint, item), - cert=self.session.cert, - verify=self.session.verify, + session=self.session, timeout=self._timeout, project=self._project, ) diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/connection.py python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/connection.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/connection.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/connection.py 2023-02-14 14:53:42.000000000 +0000 @@ -70,7 +70,6 @@ class _LXDResponse(NamedTuple): - status: int body: bytes json: Any diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/image.py python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/image.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/image.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/image.py 2023-02-14 14:53:42.000000000 +0000 @@ -132,7 +132,7 @@ image_size = data["size"] if image_size <= 0: raise exceptions.ImageInvalidSize() - return image_size // 1024 ** 2 + return image_size // 1024**2 except Exception as e: print("Unable to fetch image info - {}".format(e)) raise diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/tests/test_image.py python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/tests/test_image.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/deprecated/tests/test_image.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/deprecated/tests/test_image.py 2023-02-14 14:53:42.000000000 +0000 @@ -30,7 +30,6 @@ return_value=("200", fake_api.fake_image_info()), ) class LXDAPIImageTestObject(LXDAPITestBase): - list_data = ( ("list", (), ()), ("search", ({"foo": "bar"},), ("foo=bar",)), diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/managers.py python-pylxd-2.3.2~alpha1-426-10/pylxd/managers.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/managers.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/managers.py 2023-02-14 14:53:42.000000000 +0000 @@ -82,7 +82,6 @@ class ClusterManager(BaseManager): - manager_for = "pylxd.models.Cluster" def __init__(self, client, *args, **kwargs): diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/models/instance.py python-pylxd-2.3.2~alpha1-426-10/pylxd/models/instance.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/models/instance.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/models/instance.py 2023-02-14 14:53:42.000000000 +0000 @@ -35,7 +35,6 @@ class _InstanceExecuteResult(NamedTuple): - exit_code: int stdout: IO stderr: IO diff -Nru python-pylxd-2.3.2~alpha1-422-10/pylxd/tests/test_client.py python-pylxd-2.3.2~alpha1-426-10/pylxd/tests/test_client.py --- python-pylxd-2.3.2~alpha1-422-10/pylxd/tests/test_client.py 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/pylxd/tests/test_client.py 2023-02-14 14:53:42.000000000 +0000 @@ -495,6 +495,12 @@ node = client._APINode("http+unix://test.com") self.assertIsInstance(node.session, requests_unixsocket.Session) + def test_session_passed_to_child(self): + """session should be shared across path traversl""" + parent_node = client._APINode("http+unix://test.com") + child_node = parent_node.instances + self.assertIs(parent_node.session, child_node.session) + @mock.patch("pylxd.client.requests.Session") def test_get(self, Session): """Perform a session get.""" diff -Nru python-pylxd-2.3.2~alpha1-422-10/setup.cfg python-pylxd-2.3.2~alpha1-426-10/setup.cfg --- python-pylxd-2.3.2~alpha1-422-10/setup.cfg 2023-02-14 00:01:48.000000000 +0000 +++ python-pylxd-2.3.2~alpha1-426-10/setup.cfg 2023-02-14 14:53:42.000000000 +0000 @@ -34,10 +34,9 @@ # of requests-mock. Thus, we have to pin it down. requests-mock < 1.2 format = - black == 20.8b1 + black == 23.1.0 flake8 >= 2.5.0 isort == 5.6.4 - click < 8.1.0 check = mypy doc =