Skip to content

Commit 4c43628

Browse files
authored
Merge pull request #746 from cderici/fix-charmhub-series-deploy-3.0
#746 #### Description This fixes the issue with `model.deploy` using charmhub, where we're trying to get the `series` field from the origin returned by resolving the charm. However, `CharmOrigin` no longer has the `series` field in Juju 3.0 (it's replaced with the `base` field), so the origin we get as a part of the result of calling the `ResolveCharms` function no longer has the `series` field. Note that we gotta keep it in place for clients using older controllers (i.e. `2.9`). This also fixes the issue where we apparently hardcoded the version of the `Resources` interface (to be 2). With this change, we get that info dynamically from the facade version. #### QA Steps Following should work with both `2.9` and `3.0/candidate` controllers. ```python application = await model.deploy( 'ch:minio' ) ``` #### Notes & Discussion We also need to focus on the `latest-edge` jenkins CI job, which is currently not working (for jenkins infra issues). I suspect that the change in the `CharmOrigin` is fundamental enough that a bunch more things will blow in libjuju. Therefore the CI test against the latest juju becomes critical, as we would've caught this issue way before it's raised if the jenkins job was working correctly.
2 parents 2af44fc + 293af93 commit 4c43628

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

juju/client/overrides.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ async def AddPendingResources(self,
8080
Returns -> typing.Union[_ForwardRef('ErrorResult'),
8181
typing.Sequence<+T_co>[str]]
8282
"""
83+
version = _client.ResourcesFacade.best_facade_version(self.connection)
8384
# map input types to rpc msg
8485
_params = dict()
8586
msg = dict(type='Resources',
8687
request='AddPendingResources',
87-
version=2,
88+
version=version,
8889
params=_params)
8990
_params['tag'] = application_tag
9091
_params['url'] = charm_url

juju/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,8 @@ async def deploy(
17391739
raise JujuError('unknown charm or bundle {}'.format(entity_url))
17401740
identifier = res.identifier
17411741

1742-
series = res.origin.series or series
1742+
series = res.origin.series if self.connection().is_using_old_client \
1743+
else series
17431744
if res.is_bundle:
17441745
handler = BundleHandler(self, trusted=trust, forced=force)
17451746
await handler.fetch_plan(url, res.origin, overlays=overlays)

0 commit comments

Comments
 (0)