Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.3.0.0: AttributeError: 'ActionFacade' object has no attribute 'EnqueueOperation' #705

Closed
sed-i opened this issue Aug 10, 2022 · 1 comment

Comments

@sed-i
Copy link
Contributor

sed-i commented Aug 10, 2022

With pylibjuju 3.0.0 there is now a facade error:

   File "/home/runner/work/prometheus-k8s-operator/prometheus-k8s-operator/.tox/integration/lib/python3.8/site-packages/juju/unit.py", line 233, in run_action
    res = await action_facade.EnqueueOperation(actions=[client.Action(
AttributeError: 'ActionFacade' object has no attribute 'EnqueueOperation'
@cderici
Copy link
Contributor

cderici commented Aug 10, 2022

Yeah I'm currently working on a fix on actions that'll solve this one as well, thanks for reporting 👍

jujubot added a commit that referenced this issue Aug 11, 2022
#706

#### Description

This change attempts to fix the `Unit.run_actions` issue where the resulting object is different based on the used Facade (which is based on whether the `2.9` or `3.0` juju client is being used). With this change both ways will return the same type of object as a result of running the action on the unit. It's also a continuation/possible-regression-fix of #698.

Also adding the `EnvironUpgrader` facade that's introduced in `Juju 3.0`, so we shouldn't get the "unexpected facade" warning anymore.

Also updating the clients with the latest schema from juju 3.0. In particuılar the Application facade version is bumped up `13` -> `14`.

With this #705 should be fixed too. 

#### QA Steps

QA steps for this is sort of a simulation of one of the real world libjuju uses in a function on [mongodb-operator](https://github.com/canonical/mongodb-operator/blob/8796be02e10b84f990da0426ad1cff5922dc506a/tests/integration/helpers.py#L39).

Get a controller on a k8s cloud (I did it on `microk8s`). The following then should work fine.
Full QA should be done with 2 separate controllers (at least that's what I did): one bootstrapped with `juju 2.9` and another with `juju 3.0`.

```python
async def _get_password():
 model = Model()
 await model.connect()
 await model.deploy('zinc-k8s')
 await model.wait_for_idle(status="active")

 unit = model.applications['zinc-k8s'].units[0]
 action = await unit.run_action("get-admin-password")
 action = await action.wait()
 print(action.results["admin-password"])
 await model.disconnect()
```

#### Notes & Discussion

This is also related (and most likely a fix) to:
* openstack-charmers/zaza#545
* openstack-charmers/zaza#546
* https://github.com/canonical/mongodb-operator/runs/7761747331?check_suite_focus=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants