Fix the tag image fetch model method.

This commit is contained in:
yackob03 2013-09-26 17:58:41 -04:00
parent 9278871381
commit fa1fc7f9a2

View file

@ -144,9 +144,14 @@ def list_repository_tags(namespace_name, repository_name):
def get_tag_image(namespace_name, repository_name, tag_name):
joined = Image.select().join(RepositoryTag).join(Repository)
return joined.where(Repository.name == repository_name,
Repository.namespace == namespace_name,
RepositoryTag.name == tag_name)
fetched = list(joined.where(Repository.name == repository_name,
Repository.namespace == namespace_name,
RepositoryTag.name == tag_name))
if not fetched:
raise Image.DoesNotExist('Unable to find image for tag.')
return fetched[0]
def create_or_update_tag(namespace_name, repository_name, tag_name,