X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju%2Fmodel.py;h=55ad086dcbb7acb8b08be49646a3d3079ac2af81;hb=2399bdd31415f9be498cd0e6f805586d7c18015d;hp=3df26692ed58af2d474058e0fe9cd20f19628d05;hpb=5db9c4c5f0c88c73f06ac285294f9ab688e5bc97;p=osm%2FN2VC.git diff --git a/juju/model.py b/juju/model.py index 3df2669..55ad086 100644 --- a/juju/model.py +++ b/juju/model.py @@ -935,6 +935,22 @@ class Model(object): """ raise NotImplementedError() + def _get_series(self, entity_url, entity): + # try to get the series from the provided charm URL + if entity_url.startswith('cs:'): + parts = entity_url[3:].split('/') + else: + parts = entity_url.split('/') + if parts[0].startswith('~'): + parts.pop(0) + if len(parts) > 1: + # series was specified in the URL + return parts[0] + # series was not supplied at all, so use the newest + # supported series according to the charm store + ss = entity['Meta']['supported-series'] + return ss['SupportedSeries'][0] + async def deploy( self, entity_url, application_name=None, bind=None, budget=None, channel=None, config=None, constraints=None, force=False, @@ -1018,22 +1034,8 @@ class Model(object): if not is_local: if not application_name: application_name = entity['Meta']['charm-metadata']['Name'] - if not series and '/' in entity_url: - # try to get the series from the provided charm URL - if entity_url.startswith('cs:'): - parts = entity_url[3:].split('/') - else: - parts = entity_url.split('/') - if parts[0].startswith('~'): - parts.pop(0) - if len(parts) > 1: - # series was specified in the URL - series = parts[0] if not series: - # series was not supplied at all, so use the newest - # supported series according to the charm store - ss = entity['Meta']['supported-series'] - series = ss['SupportedSeries'][0] + series = self._get_series(entity_url, entity) if not channel: channel = 'stable' await client_facade.AddCharm(channel, entity_id) @@ -1563,9 +1565,6 @@ class BundleHandler(object): self.plan = await self.client_facade.GetBundleChanges( yaml.dump(self.bundle)) - if self.plan.errors: - raise JujuError('\n'.join(self.plan.errors)) - async def execute_plan(self): for step in self.plan.changes: method = getattr(self, step.method)