Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing data from the API #355

Merged
merged 2 commits into from Sep 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions juju/bundle.py
Expand Up @@ -325,7 +325,7 @@ async def run(self, context):
charm_url=charm,
application=self.application,
series=self.series,
config=self.options,
config=options,
constraints=self.constraints,
endpoint_bindings=self.endpoint_bindings,
resources=resources,
Expand All @@ -337,10 +337,10 @@ async def run(self, context):

def __str__(self):
series = ""
if self.series != "":
if self.series is not None and self.series != "":
series = " on {}".format(self.series)
units_info = ""
if self.num_units > 0:
if self.num_units is not None:
plural = ""
if self.num_units > 1:
plural = "s"
Expand Down Expand Up @@ -413,7 +413,7 @@ async def run(self, context):
def __str__(self):
series = ""
channel = ""
if self.series != "":
if self.series is not None and self.series != "":
series = " for series {}".format(self.series)
if self.channel is not None:
channel = " from channel {}".format(self.channel)
Expand Down Expand Up @@ -681,9 +681,12 @@ async def run(self, context):
await context.model.create_offer(ep, offer_name=self.offer_name, application_name=application)

def __str__(self):
endpoints = ""
if self.endpoints is not None:
endpoints = self.endpoints.join(",")
return "create offer {offer_name} using {application}:{endpoints}".format(offer_name=self.offer_name,
application=self.application,
endpoints=self.endpoints.join(","))
endpoints=endpoints)
SimonRichardson marked this conversation as resolved.
Show resolved Hide resolved


class ConsumeOfferChange(ChangeInfo):
Expand Down