@@ -1739,8 +1739,12 @@ async def deploy(
17391739 raise JujuError ('unknown charm or bundle {}' .format (entity_url ))
17401740 identifier = res .identifier
17411741
1742- series = res .origin .series if self .connection ().is_using_old_client \
1743- else series
1742+ charm_series = series
1743+
1744+ if self .connection ().is_using_old_client and charm_series is None :
1745+ # Also try
1746+ charm_series = res .origin .series
1747+
17441748 if res .is_bundle :
17451749 handler = BundleHandler (self , trusted = trust , forced = force )
17461750 await handler .fetch_plan (url , res .origin , overlays = overlays )
@@ -1792,25 +1796,27 @@ async def deploy(
17921796 metadata = utils .get_local_charm_metadata (charm_dir )
17931797 # TODO (cderici) : pass the metadata into get_charm_series, as
17941798 # it also reads that file redundantly
1795- series = series or await get_charm_series (charm_dir , self )
1799+ charm_series = charm_series or await get_charm_series (charm_dir ,
1800+ self )
17961801
17971802 # If we're using a newer client, then the CharmOrigin needs a
17981803 # base
17991804 if not self .connection ().is_using_old_client :
1800- charm_origin .base = utils .get_local_charm_base (series ,
1805+ charm_origin .base = utils .get_local_charm_base (charm_series ,
18011806 channel ,
18021807 metadata ,
18031808 charm_dir ,
18041809 client .Base )
18051810
18061811 if not application_name :
18071812 application_name = metadata ['name' ]
1808- if self .connection ().is_using_old_client and not series :
1813+ if self .connection ().is_using_old_client and not charm_series :
18091814 raise JujuError (
18101815 "Couldn't determine series for charm at {}. "
18111816 "Pass a 'series' kwarg to Model.deploy()." .format (
18121817 charm_dir ))
1813- identifier = await self .add_local_charm_dir (charm_dir , series )
1818+ identifier = await self .add_local_charm_dir (charm_dir ,
1819+ charm_series )
18141820 resources = await self .add_local_resources (application_name ,
18151821 identifier ,
18161822 metadata ,
@@ -1824,7 +1830,7 @@ async def deploy(
18241830 return await self ._deploy (
18251831 charm_url = identifier ,
18261832 application = res .app_name ,
1827- series = series ,
1833+ series = charm_series ,
18281834 config = config ,
18291835 constraints = constraints ,
18301836 endpoint_bindings = bind ,
@@ -1867,9 +1873,9 @@ async def _resolve_charm(self, url, origin):
18671873 'track' : origin .track ,
18681874 'risk' : origin .risk ,
18691875 }
1870-
18711876 if not self .connection ().is_using_old_client :
18721877 resolve_origin ['base' ] = origin .base
1878+
18731879 resp = await charms_facade .ResolveCharms (resolve = [{
18741880 'reference' : str (url ),
18751881 'charm-origin' : resolve_origin
0 commit comments