From 8fc499161a1b1b4c55cdbf3265e23cebab02e985 Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Sat, 2 Jan 2016 13:02:55 +0100 Subject: [PATCH] don't display junk --- sen/docker_backend.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sen/docker_backend.py b/sen/docker_backend.py index d12d65c..6c0ecf1 100644 --- a/sen/docker_backend.py +++ b/sen/docker_backend.py @@ -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 != "" else "" - if tag and self.tag: + # don't display junk + if tag and self.tag and self.tag != "": result = '{0}:{1}'.format(result, self.tag) - elif tag and explicit_tag: + elif tag and explicit_tag and self.tag != "": result = '{0}:{1}'.format(result, 'latest') + # don't display junk if self.namespace: result = '{0}/{1}'.format(self.namespace, result) elif explicit_namespace: @@ -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