Skip to content

Commit b03c1df

Browse files
committed
Clear out charmstore specific code in upgrade charm
1 parent 2c899b3 commit b03c1df

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

juju/application.py

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pathlib
1919

2020
from . import model, tag, utils, jasyncio
21-
from .url import URL, Schema
21+
from .url import URL
2222
from .status import derive_status
2323
from .annotationhelper import _get_annotations, _set_annotations
2424
from .client import client
@@ -675,31 +675,14 @@ async def refresh(
675675

676676
# Make the source-specific changes to the origin/channel/url
677677
# (and also get the resources necessary to deploy the (destination) charm -- for later)
678-
if Schema.CHARM_HUB.matches(parsed_url.schema):
679-
origin.source = Source.CHARM_HUB
680-
if channel:
681-
ch = Channel.parse(channel).normalize()
682-
origin.risk = ch.risk
683-
origin.track = ch.track
684-
685-
charmhub = self.model.charmhub
686-
charm_resources = await charmhub.list_resources(charm_name)
687-
else:
688-
charmstore = self.model.charmstore
689-
charmstore_entity = None
690-
if switch is None:
691-
charm_url = charm_url.rpartition('-')[0]
692-
if revision is not None:
693-
charm_url = "%s-%d" % (charm_url, revision)
694-
else:
695-
charmstore_entity = await charmstore.entity(charm_url, channel=channel)
696-
charm_url = charmstore_entity['Id']
697-
origin.source = 'charm-store'
698-
if channel:
699-
origin.risk = channel
700-
if charmstore_entity is None:
701-
charmstore_entity = await charmstore.entity(charm_url, channel=channel)
702-
charm_resources = charmstore_entity['Meta']['resources']
678+
origin.source = Source.CHARM_HUB.value
679+
if channel:
680+
ch = Channel.parse(channel).normalize()
681+
origin.risk = ch.risk
682+
origin.track = ch.track
683+
684+
charmhub = self.model.charmhub
685+
charm_resources = await charmhub.list_resources(charm_name)
703686

704687
# Resolve the given charm URLs with an optionally specified preferred channel.
705688
# Channel provided via CharmOrigin.

0 commit comments

Comments
 (0)