diff --git a/bin/is b/bin/is index e872a6a0ec93e5e5e08d641f86c320f144c488e7..4ebd6b168178029635ba1e0380d138640cb32016 100755 --- a/bin/is +++ b/bin/is @@ -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: diff --git a/installsystems/repository.py b/installsystems/repository.py index a716b24f34f53874a0c520bb6aa6e8593b0c572d..3e11c5f48ca8f7ca0da0f7ed37ea4e296631da90 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -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()