From 4930a4f7663cba676e0f833ed455db719c67bccc Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Thu, 27 Jun 2024 13:44:44 +0200 Subject: [PATCH 1/3] fix(model): fix wrong instanciation of list-secrets facade ListSecrets facade takes 2 arguments: `filter_`, and `show_secrets`. Previous instanciation passed a dict, which then landed in `filter_` field. Fix #947 --- juju/model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/juju/model.py b/juju/model.py index 45faa99e..a51944de 100644 --- a/juju/model.py +++ b/juju/model.py @@ -2704,15 +2704,15 @@ async def update_secret(self, name, data_args=[], new_name="", file="", info="") if result_error.error is not None: raise JujuAPIError(result_error.error) - async def list_secrets(self, filter="", show_secrets=False): + async def list_secrets(self, filter=None, show_secrets=False): """ Returns the list of available secrets. """ facade = client.SecretsFacade.from_connection(self.connection()) - results = await facade.ListSecrets({ - 'filter': filter, - 'show-secrets': show_secrets, - }) + results = await facade.ListSecrets( + filter_=filter, + show_secrets=show_secrets, + ) return results.results async def remove_secret(self, secret_name, revision=-1): From 6bfbe2409aa1a5768a4200c06ac5d4dde7486fd1 Mon Sep 17 00:00:00 2001 From: Jack Shaw Date: Wed, 26 Jun 2024 11:52:29 +0100 Subject: [PATCH 2/3] fix(series): add noble support The pylibjuju client hardcodes a mapping between series codename and the base channel. Noble was absent from this mapping, meaning pylibjuju doesn't know know to deploy to noble. Add noble to this mapping. After noble, we will only support deploying by base. Noble will be the last series added to this map Add an integration test which deploys a charm to noble --- juju/utils.py | 2 ++ tests/integration/charm-manifest/manifest.yaml | 4 ++++ tests/integration/test_model.py | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/juju/utils.py b/juju/utils.py index 1b6854f7..c4f4780a 100644 --- a/juju/utils.py +++ b/juju/utils.py @@ -301,6 +301,7 @@ def get_local_charm_charmcraft_yaml(path): KINETIC = "kinetic" LUNAR = "lunar" MANTIC = "mantic" +NOBLE = "noble" UBUNTU_SERIES = { PRECISE: "12.04", @@ -327,6 +328,7 @@ def get_local_charm_charmcraft_yaml(path): KINETIC: "22.10", LUNAR: "23.04", MANTIC: "23.10", + NOBLE: "24.04", } KUBERNETES = "kubernetes" diff --git a/tests/integration/charm-manifest/manifest.yaml b/tests/integration/charm-manifest/manifest.yaml index dbb75e78..37c9d7ec 100644 --- a/tests/integration/charm-manifest/manifest.yaml +++ b/tests/integration/charm-manifest/manifest.yaml @@ -9,5 +9,9 @@ bases: - amd64 channel: '20.04' name: ubuntu +- architectures: + - amd64 + channel: '24.04' + name: ubuntu charmcraft-started-at: '2021-08-20T08:09:00.639806Z' charmcraft-version: 1.2.1 diff --git a/tests/integration/test_model.py b/tests/integration/test_model.py index d10e3fbb..8d213553 100644 --- a/tests/integration/test_model.py +++ b/tests/integration/test_model.py @@ -437,6 +437,15 @@ async def test_deploy_with_base(): await model.wait_for_idle(status='active') +@base.bootstrapped +async def test_deploy_noble(): + charm_path = INTEGRATION_TEST_DIR / 'charm-manifest' + + async with base.CleanModel() as model: + await model.deploy(str(charm_path), base="ubuntu@24.04") + await model.wait_for_idle(status='active') + + @base.bootstrapped async def test_add_machine(): from juju.machine import Machine From c12adde776fe334a972f184f8d4cfbb1efb4e32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Simas?= Date: Mon, 20 May 2024 10:52:47 -0300 Subject: [PATCH 3/3] fix zones constrains list parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luís Simas --- juju/constraints.py | 2 +- tests/unit/test_constraints.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/juju/constraints.py b/juju/constraints.py index 2574b6b0..3315fead 100644 --- a/juju/constraints.py +++ b/juju/constraints.py @@ -54,7 +54,7 @@ "zones", "allocate_public_ip"] -LIST_KEYS = {'tags', 'spaces'} +LIST_KEYS = {'tags', 'spaces', 'zones'} SNAKE1 = re.compile(r'(.)([A-Z][a-z]+)') SNAKE2 = re.compile('([a-z0-9])([A-Z])') diff --git a/tests/unit/test_constraints.py b/tests/unit/test_constraints.py index 03b2013f..1fac2ccd 100644 --- a/tests/unit/test_constraints.py +++ b/tests/unit/test_constraints.py @@ -60,7 +60,7 @@ def test_parse_constraints(self): self.assertEqual( _("mem=10G zones=bar,baz tags=tag1 spaces=space1,space2"), {"mem": 10 * 1024, - "zones": "bar,baz", + "zones": ["bar", "baz"], "tags": ["tag1"], "spaces": ["space1", "space2"]} )