Commit 914e3b4
authored
Merge pull request #854 from cderici/fix-type-parsing-in-facade.py
#854
#### Description
This fixes a bug found in the `facade.py` parsing simple entries in the `Type.from_json()` function.
Should fix #850 & #851
#### QA Steps
To go with the same way of #850 and #851 to reproduce this, using juju `2.9.42`, bootstrap a k8s model (I did it on microk8s).
```sh
$ juju bootstrap microk8s removeme
```
Then get a libjuju console on the toplevel dir:
```sh
$ python -m asyncio
```
Then the following should work just fine:
```sh
from juju import model;m = model.Model(); await m.connect(); await m.deploy("postgresql", channel="14/edge")
```
Also added an integration test that should work (fails without this change):
```tox
tox -e integration -- tests/integration/test_model.py::test_deploy_charm_assumes
```
which just runs `await model.deploy('postgresql', channel='14/edge')`
Note that this is not the ideal test because it depends on that the upstream charm having the simple
assumes:
-juju
expression. However, simulating the bug in the facade.py for parsing such expressions is non-trivial as we need a test to call something like the CharmsFacade.CharmInfo() to trigger parsing the metadata (which is actually where it fails in the reported bug). Creating a local charm wouldn't work because we locally handle the metadata (wihtout going through anything in the facade.py where the bug is located). Maybe we can manually call AddCharm in the test for a local charm and then manually call the CharmInfo with the returned url.
All CI tests need to pass.
#### Notes & Discussion
This will need to be forward ported into the master.2 files changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
| |||
0 commit comments