Skip to content

Commit 3098a08

Browse files
committed
Add capability for deploying by revision
by passing the revision info through the ResolveCharm api call. fixes #690
1 parent d809caf commit 3098a08

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

juju/model.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class CharmhubDeployType:
492492
def __init__(self, charm_resolver):
493493
self.charm_resolver = charm_resolver
494494

495-
async def resolve(self, url, architecture, app_name=None, channel=None, series=None, entity_url=None):
495+
async def resolve(self, url, architecture, app_name=None, channel=None, series=None, revision=None, entity_url=None):
496496
"""resolve attempts to resolve charmhub charms or bundles. A request to
497497
the charmhub API is required to correctly determine the charm url and
498498
underlying origin.
@@ -511,6 +511,7 @@ async def resolve(self, url, architecture, app_name=None, channel=None, series=N
511511
risk=ch.risk,
512512
track=ch.track,
513513
base=base,
514+
revision=revision,
514515
)
515516

516517
charm_url_str, origin, supported_series = await self.charm_resolver(url, origin)
@@ -1611,7 +1612,7 @@ async def debug_log(
16111612
async def deploy(
16121613
self, entity_url, application_name=None, bind=None,
16131614
channel=None, config=None, constraints=None, force=False,
1614-
num_units=1, overlays=[], base=None, resources=None, series=None,
1615+
num_units=1, overlays=[], base=None, resources=None, series=None, revision=None,
16151616
storage=None, to=None, devices=None, trust=False, attach_storage=[]):
16161617
"""Deploy a new service or bundle.
16171618
@@ -1630,6 +1631,8 @@ async def deploy(
16301631
:param str base: The base on which to deploy
16311632
:param dict resources: <resource name>:<file path> pairs
16321633
:param str series: Series on which to deploy DEPRECATED: use --base (with Juju 3.1)
1634+
:param int revision: specifying a revision requires a channel for future upgrades for charms.
1635+
For bundles, revision and channel are mutually exclusive.
16331636
:param dict storage: Storage constraints TODO how do these look?
16341637
:param to: Placement directive as a string. For example:
16351638
@@ -1675,7 +1678,7 @@ async def deploy(
16751678
if str(url.schema) not in self.deploy_types:
16761679
raise JujuError("unknown deploy type {}, expected charmhub or local".format(url.schema))
16771680

1678-
res = await self.deploy_types[str(url.schema)].resolve(url, architecture, application_name, channel, series, entity_url)
1681+
res = await self.deploy_types[str(url.schema)].resolve(url, architecture, application_name, channel, series, revision, entity_url)
16791682

16801683
if res.identifier is None:
16811684
raise JujuError('unknown charm or bundle {}'.format(entity_url))

0 commit comments

Comments
 (0)