Commit 4f38c4e
authored
Merge pull request #1009 from cderici/controller-name-not-found
#1009
#### Description
`controllers.yaml` is read for the `controller_name` after a connection is established, and this creates a dependency on the juju-cli to be installed in the system, which is not required for pylibjuju.
Fixes #996
#### QA Steps
Testing this requires a bit of stateful actions. I see two easy ways to test:
1. Use the integration test I added.
Add `import pdb;pdb.set_trace()` right before the `new_cont.connect(` line, and run the integration test with `--pdb` as follows:
```
tox -e integration -- -- tests/integration/test_connection.py::test_connection_happy_path --pdb
```
Before continuing, go find the `controllers.yaml` and rename it to something else (sort of easier than removing juju-cli etc):
```
mv controllers.yaml controllers.yaml.tmp
```
Now continue in the pdb (`c`) to see if the new connection will be established without a problem.
2. Do what the integration test is doing manually in the repl:
```python
$ python -m asyncio
>>> from juju import controller
>>> c=controller.Controller();await c.connect()
```
Stop at this point to rename the `controllers.yaml` file.
```python
>>> new_c=controller.Controller()
>>> await new_c.connect(endpoint=c.endpoint, username=c.username, password=c.password, cacert=c.cacert)
```
This should succeed.
Don't forget to rename your controllers.yaml back:
```
mv controllers.yaml.tmp controllers.yaml
```
#### Notes & Discussion
JUJU-53174 files changed
Lines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
| |||
0 commit comments