Commit 93b0718
authored
Merge pull request #986 from cderici/add-secrets
#986
#### Description
This is the first PR in exposing user secrets for python-libjuju. I decided to split this work into multiple PRs (rest is/are coming right after this) because this PR was getting really big with the updated schema and the clients etc.
The main changes are as follows:
- Adds a new `secrets.py` module that contains the client logic for producing the data bag for secrets to be added (and updated), including reading values from yaml/json files etc.
- Updates the schema with the latest 3.3 schema from juju and re-generates the clients to get the `Secrets` v2 facade.
- Adds the `model.add_secret()` function that corresponds to `juju add-secret` cli command.
#### QA Steps
Some unit tests are added for the functions in the new `secrets.py` module.
```
tox -e py3 -- tests/unit/test_secrets.py::TestCreateSecretData
```
```
tox -e py3 -- tests/unit/test_secrets.py::TestReadSecretData
```
Also added an integration test for `add_secret`:
```
tox -e integration -- tests/integration/test_secrets.py::test_add_secret
```
This can also be tested manually by using Python repl:
```python
$ python -m asyncio
>>> from juju import model
>>> m=model.Model();await m.connect()
>>> await model.add_secret(name='my-apitoken', dataArgs=['token=34ae35facd4'])
secret:........
```
After this, check the `juju secrets`, you should see the newly added secret.
#### Notes & Discussion
JUJU-492619 files changed
Lines changed: 7230 additions & 138 deletions
File tree
- .github/workflows
- juju
- client
- tests
- integration
- charm-base-charmcraft-yaml
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
559 | 567 | | |
| |||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5130 | 5130 | | |
5131 | 5131 | | |
5132 | 5132 | | |
5133 | | - | |
| 5133 | + | |
| 5134 | + | |
5134 | 5135 | | |
5135 | 5136 | | |
5136 | | - | |
| 5137 | + | |
5137 | 5138 | | |
5138 | 5139 | | |
5139 | 5140 | | |
| |||
5159 | 5160 | | |
5160 | 5161 | | |
5161 | 5162 | | |
| 5163 | + | |
5162 | 5164 | | |
5163 | 5165 | | |
| 5166 | + | |
5164 | 5167 | | |
5165 | 5168 | | |
5166 | 5169 | | |
| |||
5228 | 5231 | | |
5229 | 5232 | | |
5230 | 5233 | | |
5231 | | - | |
| 5234 | + | |
| 5235 | + | |
5232 | 5236 | | |
5233 | 5237 | | |
5234 | 5238 | | |
| |||
5247 | 5251 | | |
5248 | 5252 | | |
5249 | 5253 | | |
| 5254 | + | |
5250 | 5255 | | |
5251 | 5256 | | |
5252 | 5257 | | |
| |||
5255 | 5260 | | |
5256 | 5261 | | |
5257 | 5262 | | |
5258 | | - | |
| 5263 | + | |
| 5264 | + | |
| 5265 | + | |
5259 | 5266 | | |
5260 | 5267 | | |
5261 | 5268 | | |
| |||
5330 | 5337 | | |
5331 | 5338 | | |
5332 | 5339 | | |
5333 | | - | |
| 5340 | + | |
5334 | 5341 | | |
5335 | 5342 | | |
5336 | 5343 | | |
5337 | 5344 | | |
| 5345 | + | |
5338 | 5346 | | |
5339 | 5347 | | |
5340 | 5348 | | |
5341 | 5349 | | |
5342 | 5350 | | |
5343 | 5351 | | |
| 5352 | + | |
| 5353 | + | |
| 5354 | + | |
5344 | 5355 | | |
5345 | 5356 | | |
5346 | 5357 | | |
| |||
5351 | 5362 | | |
5352 | 5363 | | |
5353 | 5364 | | |
| 5365 | + | |
5354 | 5366 | | |
5355 | 5367 | | |
5356 | 5368 | | |
| |||
5409 | 5421 | | |
5410 | 5422 | | |
5411 | 5423 | | |
5412 | | - | |
| 5424 | + | |
5413 | 5425 | | |
5414 | 5426 | | |
5415 | 5427 | | |
5416 | 5428 | | |
| 5429 | + | |
5417 | 5430 | | |
5418 | 5431 | | |
5419 | 5432 | | |
5420 | 5433 | | |
5421 | 5434 | | |
5422 | 5435 | | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
5423 | 5439 | | |
5424 | 5440 | | |
5425 | 5441 | | |
| |||
5430 | 5446 | | |
5431 | 5447 | | |
5432 | 5448 | | |
| 5449 | + | |
5433 | 5450 | | |
5434 | 5451 | | |
5435 | 5452 | | |
| |||
5488 | 5505 | | |
5489 | 5506 | | |
5490 | 5507 | | |
5491 | | - | |
| 5508 | + | |
| 5509 | + | |
5492 | 5510 | | |
5493 | 5511 | | |
5494 | | - | |
| 5512 | + | |
5495 | 5513 | | |
5496 | 5514 | | |
5497 | 5515 | | |
| |||
0 commit comments