Skip to content
Snippets Groups Projects
Commit 6fda3bf8 authored by Seblu's avatar Seblu
Browse files

stricter check during image selection

parent ad8a731f
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,11 @@ def select_image(name, repoman):
if istools.isfile(name) and os.path.isfile(name):
return PackageImage(name), None
else:
(repo, image, version) = re.match("((\w+)/)?(\w+)(:v?(\d+))?", name).group(2,3,5)
x = re.match("^((\w+)/)?(\w+)(:v?(\d+))?$", name)
if x is None:
raise Exception("%s is not a valid image" % name)
(repo, image, version) = x.group(2,3,5)
debug("Selected image is %s v%s in %s" % (image, version, repo))
if repo is None:
return repoman.get(image, version)
else:
......
......@@ -266,6 +266,9 @@ class Repository(object):
# is no version take the last
if version is None:
version = self.last(name)
if version < 0:
raise Exception("Unable to find last version of %s in %s" % (name,
self.config.name))
# get file md5 from db
r = self.db.ask("select md5 from image where name = ? and version = ? limit 1",
(name,version)).fetchone()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment