Skip to content

Commit

Permalink
don't display <none> junk
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasTomecek committed Jan 2, 2016
1 parent ce818af commit 8fc4991
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sen/docker_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ def to_str(self, registry=True, tag=True, explicit_tag=False,
if self.repo is None:
raise RuntimeError('No image repository specified')

result = self.repo
result = self.repo if self.repo != "<none>" else ""

if tag and self.tag:
# don't display <none> junk
if tag and self.tag and self.tag != "<none>":
result = '{0}:{1}'.format(result, self.tag)
elif tag and explicit_tag:
elif tag and explicit_tag and self.tag != "<none>":
result = '{0}:{1}'.format(result, 'latest')

# don't display <none> junk
if self.namespace:
result = '{0}/{1}'.format(self.namespace, result)
elif explicit_namespace:
Expand Down Expand Up @@ -248,7 +250,9 @@ def names(self):
if self.data is None:
return self._names
for t in self.data["RepoTags"]:
self._names.append(ImageNameStruct.parse(t))
image_name = ImageNameStruct.parse(t)
if image_name.to_str():
self._names.append(image_name)
# sort by name length
self._names.sort(key=lambda x: len(x.to_str()))
return self._names
Expand Down

0 comments on commit 8fc4991

Please sign in to comment.