Repository: juju/python-libjuju

Issue:
Incorrect parsing of zones constraint
### Description

When deploying a bundle with the `zones` constraint in a machine, the deployment fails with the following error from the juju API:

```
juju.errors.JujuAPIError: json: cannot unmarshal string into Go struct field Value.params.constraints.zones of type []string
```

The problem seems to be that python-libjuju sends the `zones` key as a string instead of an array of strings, as juju expects. See: https://github.com/juju/juju/blob/3.6/core/constraints/constraints.go#L107.

### Urgency

Annoying bug in our test suite

### Python-libjuju version

3.4

### Juju version

3.4.2

### Reproduce / Test

```python
import asyncio
from juju.model import Model

bundle_file = "./bundle.yaml"

bundle = """
name: sample-bundle

series: jammy

machines:
  "0":
    constraints: zones=z-1

applications:
  postgresql:
    charm: postgresql
    channel: 14/stable
    num_units: 1
    to:
      - lxd:0
"""

async def main():
    with open(bundle_file, "w") as f:
        f.write(bundle)

    model = Model()
    await model.connect()
    await model.deploy(bundle_file)

asyncio.run(main())
```


Discussion:
jujubot: Thanks for opening a pull request! Please follow the instructions [here](https://github.com/juju/juju/blob/develop/CONTRIBUTING.md#tldr) to ensure your pull request is ready for review. Then, a maintainer will review your patch.

@hpidcock @anvial
Aflynn50: /merge
Aflynn50: Hey @luissimas, we can't currently merge your contribution as the commit is not signed and our repo has a rule disallowing merges of unverified commits.

Would you be able to follow this [GitHub guide](https://docs.github.com/en/authentication/managing-commit-signature-verification) and force push a verified version of your commit?
luissimas: > Hey @luissimas, we can't currently merge your contribution as the commit is not signed and our repo has a rule disallowing merges of unverified commits.
> 
> Would you be able to follow this [GitHub guide](https://docs.github.com/en/authentication/managing-commit-signature-verification) and force push a verified version of your commit?

Done. I've also rebased on the main branch.
Aflynn50: /merge
Aflynn50: /build
cderici: /build
Aflynn50: /merge
cderici: /build

Patch:
diff --git a/juju/constraints.py b/juju/constraints.py
index 2574b6b..3315fea 100644
--- a/juju/constraints.py
+++ b/juju/constraints.py
@@ -54,7 +54,7 @@ SUPPORTED_KEYS = [
     "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])')


Test patch:
diff --git a/tests/unit/test_constraints.py b/tests/unit/test_constraints.py
index 03b2013..1fac2cc 100644
--- a/tests/unit/test_constraints.py
+++ b/tests/unit/test_constraints.py
@@ -60,7 +60,7 @@ class TestConstraints(unittest.TestCase):
         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"]}
         )