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

Merge master to 3.1 #845

Merged
merged 28 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f52ca42
[JUJU-3202] Add facades for 3.1.1. (#807)
juanmanuel-tirado Mar 8, 2023
67772d8
Add destroy-units to destroy several units at once
cderici Mar 8, 2023
cb9b4a9
Add integration test for destroy_units
cderici Mar 8, 2023
5c4910b
Merge pull request #812 from cderici/add-destroy-units
jujubot Mar 15, 2023
831f388
[JUJU-3517] Revisit _build_facades in connection (#826)
cderici Apr 14, 2023
ccd9067
Added 3.1.2 and 3.2-beta2 schemas.
Apr 14, 2023
d809caf
Merge pull request #828 from juanmanuel-tirado/JUJU-3527_add_32beta1_…
jujubot Apr 17, 2023
3098a08
Add capability for deploying by revision
cderici Apr 17, 2023
d101000
Add example for deploy with revision
cderici Apr 17, 2023
336c39e
Add revision parameter in LocalDeployType.resolve
cderici Apr 18, 2023
879d3c1
Add integration test for deploy by revision success
cderici Apr 19, 2023
b518f0c
Add validation for --revision flag to require --channel flag
cderici Apr 19, 2023
0deb618
Add validation for bundles to require either --revision or --channel
cderici Apr 19, 2023
4b7c8d0
Add integration test for making sure the --required and --channel
cderici Apr 19, 2023
d33a98e
[JUJU-3253] add missing force in bundle deployment (#815)
juanmanuel-tirado Mar 15, 2023
b59ef43
Pass series info into origin for ResolveCharm
cderici Apr 5, 2023
3f90162
Fix _resolve_charm errors
cderici Apr 19, 2023
dab370e
Change charm channel in bundle for test
cderici Apr 26, 2023
9670a5e
Rename example with consistent name
cderici Apr 26, 2023
36f350e
Implement series selector for charm resolution
cderici Apr 26, 2023
75e40a4
Add unit tests for series selector functionality
cderici Apr 26, 2023
66e5cc3
Utilize the series selector to construct the correct base for charms
cderici Apr 26, 2023
4308378
Fix unit tests for bundle change runs
cderici Apr 26, 2023
b5db154
Add integration test to challenge the resolver to find an old corrrec…
cderici Apr 26, 2023
96b8b07
Merge pull request #830 from cderici/deploy-by-revision
jujubot Apr 26, 2023
5b55b35
[JUJU-3552] Prepare 3.1.2.1 release (#836)
juanmanuel-tirado May 5, 2023
2b8c252
Prepare release notes for 3.1.2.0. (#843)
juanmanuel-tirado May 5, 2023
4d6ae2c
Merge remote-tracking branch 'upstream/master' into HEAD
May 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
steps:
Expand All @@ -31,7 +30,6 @@ jobs:
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
steps:
Expand All @@ -56,7 +54,6 @@ jobs:
python:
# We will reduce the workload to 3.10 to
# save some resources for now.
# - "3.8"
# - "3.9"
- "3.10"
steps:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0.1
3.1.2.0
18 changes: 18 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
---------

3.1.2.0
^^^^^^^

Friday 5th May 2022

This release has been tested with Juju 3.1.2 and contains the new
endpoints for secrets backend.

This release works with any Juju 3.x controller.

## What's Changed
* [JUJU-3202] Add facades for 3.1.1. by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/807
* Add destroy units by @cderici in https://github.com/juju/python-libjuju/pull/812
* [JUJU-3517] Revisit _build_facades in connection by @cderici in https://github.com/juju/python-libjuju/pull/826
* [JUJU-3527] Added 3.1.2 and 3.2-beta2 schemas. by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/828
* [JUJU-1628] Deploy by revision by @cderici in https://github.com/juju/python-libjuju/pull/830
* [JUJU-3552] Prepare 3.1.2.1 release by @juanmanuel-tirado in https://github.com/juju/python-libjuju/pull/836

3.1.0.1
^^^^^^^

Expand Down
3 changes: 1 addition & 2 deletions docs/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Documentation: https://pythonlibjuju.readthedocs.io/en/latest/
Requirements
------------

* Python 3.8/3.9/3.10
* Tested using Juju 3.1.0
* Python 3.9/3.10


Design Notes
Expand Down
29 changes: 17 additions & 12 deletions examples/add_secrets_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ async def main():
"""

m = Model()
await m.connect_current()
await m.connect()

# deploy postgresql
await m.deploy('postgresql')
# deploy vault
# # deploy postgresql
await m.deploy('postgresql', series="focal")
# # deploy vault
await m.deploy("vault", series="focal")
# relate/integrate
await m.relate("vault:db", "postgresql:db")
# wait for the
await m.wait_for_idle(["vault"])
# expose vault
# # relate/integrate
await m.integrate("vault:db", "postgresql:db")
# # wait for the
await m.wait_for_idle(["postgresql", "vault"])
# # expose vault
vault_app = m.applications["vault"]
await vault_app.expose()

Expand All @@ -36,13 +36,18 @@ async def main():

# Initialize vault
keys = vault_client.sys.initialize(3, 2)
print(keys)

# Unseal vault
vault_client.sys.submit_unseal_keys(keys["keys"])

target_unit = m.applications['vault'].units[0]
action = await target_unit.run_action("authorize-charm", token=keys["root_token"])
await action.wait()

# Add the secret backend
c = await m.get_controller()
response = await c.add_secret_backends("1000", "myvault", "vault", {"endpoint": vault_url})
response = await c.add_secret_backends("1111", "examplevault", "vault", {"endpoint": vault_url, "token": keys["root_token"]})
print("Output from add secret backends")
print(response["results"])

Expand All @@ -52,9 +57,9 @@ async def main():
print(list["results"])

# Remove it
await c.remove_secret_backends("myvault")
await c.remove_secret_backends("examplevault")

# Finally after removing
# # Finally after removing
list = await c.list_secret_backends()
print("Output from list secret backends after removal")
print(list["results"])
Expand Down
4 changes: 1 addition & 3 deletions examples/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ async def main():
)

print('Waiting for active')
await model.block_until(
lambda: all(unit.workload_status == 'active'
for unit in application.units))
await model.wait_for_idle(status='active')

print('Removing ubuntu')
await application.remove()
Expand Down
33 changes: 33 additions & 0 deletions examples/deploy_with_revision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from juju import jasyncio
from juju.model import Model


async def main():
charm = 'juju-qa-test'

model = Model()
print('Connecting to model')
# connect to current model with current user, per Juju CLI
await model.connect()

try:
print(f'Deploying {charm} --channel 2.0/stable --revision 22')
application = await model.deploy(
'juju-qa-test',
application_name='test',
channel='2.0/stable',
revision=22,
)

print('Waiting for active')
await model.wait_for_idle(status='active')

print(f'Removing {charm}')
await application.remove()
finally:
print('Disconnecting from model')
await model.disconnect()


if __name__ == '__main__':
jasyncio.run(main())
36 changes: 18 additions & 18 deletions juju/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from . import utils, jasyncio
from .origin import Channel, Source
from .url import Schema, URL
from .utils import get_base_from_origin_or_channel

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -349,12 +350,11 @@ async def _resolve_charms(self):
continue

charm_url = URL.parse(spec['charm'])
channel = None
series = spec.get('series', None)
track, risk = '', ''
if 'channel' in spec:
channel = Channel.parse(spec['channel'])
track, risk = channel.track, channel.risk

channel = Channel.parse(spec['channel']) if 'channel' in spec else Channel('latest', 'stable')
track, risk = channel.track, channel.risk
series = spec.get('series', self.bundle.get('series', None))
base = get_base_from_origin_or_channel(channel, series)

if self.charms_facade is not None:
if cons is not None and cons['arch'] != '':
Expand All @@ -365,16 +365,18 @@ async def _resolve_charms(self):
origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
architecture=architecture,
risk=risk,
track=track)
if not self.model.connection().is_using_old_client and series:
origin.base = client.Base(
channel=utils.get_series_version(series), name='ubuntu')
charm_url, charm_origin, _ = await self.model._resolve_charm(charm_url, origin)
track=track,
base=base,
)

charm_url, charm_origin = await self.model._resolve_charm(charm_url, origin)
spec['charm'] = str(charm_url)
else:
charm_origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
risk=risk,
track=track)
track=track,
base=base,
)

if str(channel) not in self.origins:
self.origins[str(charm_url)] = {}
Expand Down Expand Up @@ -715,15 +717,13 @@ async def run(self, context):
arch = self.architecture
if not arch:
arch = await context.model._resolve_architecture(url)
base = get_base_from_origin_or_channel(ch, self.series)
origin = client.CharmOrigin(source=Source.CHARM_HUB.value,
architecture=arch,
risk=ch.risk,
track=ch.track)
if not context.model.connection().is_using_old_client and self.series:
origin.base = client.Base(
channel=utils.get_series_version(self.series),
name='ubuntu')
identifier, origin, _ = await context.model._resolve_charm(url, origin)
track=ch.track,
base=base)
identifier, origin = await context.model._resolve_charm(url, origin)

if identifier is None:
raise JujuError('unknown charm {}'.format(self.charm))
Expand Down
4 changes: 4 additions & 0 deletions juju/client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ class CrossModelRelationsFacade(TypeFactory):
pass


class CrossModelSecretsFacade(TypeFactory):
pass


class DeployerFacade(TypeFactory):
pass

Expand Down
Loading