Skip to content

Commit e4dcd88

Browse files
authored
Merge branch 'master' into feature/test_offer
2 parents 7a1111b + 2b8c252 commit e4dcd88

31 files changed

Lines changed: 52134 additions & 259 deletions

.github/workflows/test.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
strategy:
1010
matrix:
1111
python:
12-
- "3.8"
1312
- "3.9"
1413
- "3.10"
1514
steps:
@@ -31,7 +30,6 @@ jobs:
3130
strategy:
3231
matrix:
3332
python:
34-
- "3.8"
3533
- "3.9"
3634
- "3.10"
3735
steps:
@@ -56,7 +54,6 @@ jobs:
5654
python:
5755
# We will reduce the workload to 3.10 to
5856
# save some resources for now.
59-
# - "3.8"
6057
# - "3.9"
6158
- "3.10"
6259
steps:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.0.1
1+
3.1.2.0

docs/changelog.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
Changelog
22
---------
33

4+
3.1.2.0
5+
^^^^^^^
6+
7+
Friday 5th May 2022
8+
9+
This release has been tested with Juju 3.1.2 and contains the new
10+
endpoints for secrets backend.
11+
12+
This release works with any Juju 3.x controller.
13+
14+
## What's Changed
15+
* [JUJU-3202] Add facades for 3.1.1. by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/807
16+
* Add destroy units by @cderici in https://github.com/juju/python-libjuju/pull/812
17+
* [JUJU-3517] Revisit _build_facades in connection by @cderici in https://github.com/juju/python-libjuju/pull/826
18+
* [JUJU-3527] Added 3.1.2 and 3.2-beta2 schemas. by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/828
19+
* [JUJU-1628] Deploy by revision by @cderici in https://github.com/juju/python-libjuju/pull/830
20+
* [JUJU-3552] Prepare 3.1.2.1 release by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/836
21+
422
3.1.0.1
523
^^^^^^^
624

docs/readme.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Documentation: https://pythonlibjuju.readthedocs.io/en/latest/
1111
Requirements
1212
------------
1313

14-
* Python 3.8/3.9/3.10
15-
* Tested using Juju 3.1.1
14+
* Python 3.9/3.10
1615

1716

1817
Design Notes

examples/add_secrets_backend.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ async def main():
1010
"""
1111

1212
m = Model()
13-
await m.connect_current()
13+
await m.connect()
1414

1515
# # deploy postgresql
16-
# await m.deploy('postgresql', series="focal")
16+
await m.deploy('postgresql', series="focal")
1717
# # deploy vault
1818
await m.deploy("vault", series="focal")
1919
# # relate/integrate
2020
await m.integrate("vault:db", "postgresql:db")
2121
# # wait for the
22-
await m.wait_for_idle(["vault"])
22+
await m.wait_for_idle(["postgresql", "vault"])
2323
# # expose vault
2424
vault_app = m.applications["vault"]
2525
await vault_app.expose()
@@ -38,16 +38,16 @@ async def main():
3838
keys = vault_client.sys.initialize(3, 2)
3939
print(keys)
4040

41-
target_unit = m.applications['vault'].units[0]
42-
action = await target_unit.run_action("authorize-charm", token=keys['token'])
43-
await action.wait()
44-
4541
# Unseal vault
4642
vault_client.sys.submit_unseal_keys(keys["keys"])
4743

44+
target_unit = m.applications['vault'].units[0]
45+
action = await target_unit.run_action("authorize-charm", token=keys["root_token"])
46+
await action.wait()
47+
4848
# Add the secret backend
4949
c = await m.get_controller()
50-
response = await c.add_secret_backends("1000", "myvault", "vault", {"endpoint": vault_url})
50+
response = await c.add_secret_backends("1111", "examplevault", "vault", {"endpoint": vault_url, "token": keys["root_token"]})
5151
print("Output from add secret backends")
5252
print(response["results"])
5353

@@ -57,9 +57,9 @@ async def main():
5757
print(list["results"])
5858

5959
# Remove it
60-
await c.remove_secret_backends("myvault")
60+
await c.remove_secret_backends("examplevault")
6161

62-
# Finally after removing
62+
# # Finally after removing
6363
list = await c.list_secret_backends()
6464
print("Output from list secret backends after removal")
6565
print(list["results"])

examples/deploy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ async def main():
2626
)
2727

2828
print('Waiting for active')
29-
await model.block_until(
30-
lambda: all(unit.workload_status == 'active'
31-
for unit in application.units))
29+
await model.wait_for_idle(status='active')
3230

3331
print('Removing ubuntu')
3432
await application.remove()

examples/deploy_with_revision.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from juju import jasyncio
2+
from juju.model import Model
3+
4+
5+
async def main():
6+
charm = 'juju-qa-test'
7+
8+
model = Model()
9+
print('Connecting to model')
10+
# connect to current model with current user, per Juju CLI
11+
await model.connect()
12+
13+
try:
14+
print(f'Deploying {charm} --channel 2.0/stable --revision 22')
15+
application = await model.deploy(
16+
'juju-qa-test',
17+
application_name='test',
18+
channel='2.0/stable',
19+
revision=22,
20+
)
21+
22+
print('Waiting for active')
23+
await model.wait_for_idle(status='active')
24+
25+
print(f'Removing {charm}')
26+
await application.remove()
27+
finally:
28+
print('Disconnecting from model')
29+
await model.disconnect()
30+
31+
32+
if __name__ == '__main__':
33+
jasyncio.run(main())

juju/bundle.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from . import utils, jasyncio
1818
from .origin import Channel, Source
1919
from .url import Schema, URL
20+
from .utils import get_base_from_origin_or_channel
2021

2122
log = logging.getLogger(__name__)
2223

@@ -349,12 +350,11 @@ async def _resolve_charms(self):
349350
continue
350351

351352
charm_url = URL.parse(spec['charm'])
352-
channel = None
353-
series = spec.get('series', None)
354-
track, risk = '', ''
355-
if 'channel' in spec:
356-
channel = Channel.parse(spec['channel'])
357-
track, risk = channel.track, channel.risk
353+
354+
channel = Channel.parse(spec['channel']) if 'channel' in spec else Channel('latest', 'stable')
355+
track, risk = channel.track, channel.risk
356+
series = spec.get('series', self.bundle.get('series', None))
357+
base = get_base_from_origin_or_channel(channel, series)
358358

359359
if self.charms_facade is not None:
360360
if cons is not None and cons['arch'] != '':
@@ -365,16 +365,18 @@ async def _resolve_charms(self):
365365
origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
366366
architecture=architecture,
367367
risk=risk,
368-
track=track)
369-
if not self.model.connection().is_using_old_client and series:
370-
origin.base = client.Base(
371-
channel=utils.get_series_version(series), name='ubuntu')
372-
charm_url, charm_origin, _ = await self.model._resolve_charm(charm_url, origin)
368+
track=track,
369+
base=base,
370+
)
371+
372+
charm_url, charm_origin = await self.model._resolve_charm(charm_url, origin)
373373
spec['charm'] = str(charm_url)
374374
else:
375375
charm_origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
376376
risk=risk,
377-
track=track)
377+
track=track,
378+
base=base,
379+
)
378380

379381
if str(channel) not in self.origins:
380382
self.origins[str(charm_url)] = {}
@@ -715,15 +717,13 @@ async def run(self, context):
715717
arch = self.architecture
716718
if not arch:
717719
arch = await context.model._resolve_architecture(url)
720+
base = get_base_from_origin_or_channel(ch, self.series)
718721
origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
719722
architecture=arch,
720723
risk=ch.risk,
721-
track=ch.track)
722-
if not context.model.connection().is_using_old_client and self.series:
723-
origin.base = client.Base(
724-
channel=utils.get_series_version(self.series),
725-
name='ubuntu')
726-
identifier, origin, _ = await context.model._resolve_charm(url, origin)
724+
track=ch.track,
725+
base=base)
726+
identifier, origin = await context.model._resolve_charm(url, origin)
727727

728728
if identifier is None:
729729
raise JujuError('unknown charm {}'.format(self.charm))

0 commit comments

Comments
 (0)