Loading installsystems/image.py +7 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import re import shutil import gzip import gzipstream #until python support gzip not seekable import cStringIO import installsystems.template as istemplate import installsystems.tools as istools from installsystems.printer import * Loading Loading @@ -359,7 +360,12 @@ class PackageImage(Image): try: if fileobj is None: fileobj = istools.uopen(self.path) self._tarball = Tarball.open(fileobj=fileobj, mode='r:gz') memfile = cStringIO.StringIO() fileobj.seek(0) (self.size, self.md5) = istools.copyfileobj(fileobj, memfile) fileobj.close() memfile.seek(0) self._tarball = Tarball.open(fileobj=memfile, mode='r:gz') except Exception as e: raise Exception("Unable to open image %s: %s" % (path, e)) self._metadata = self.read_metadata() Loading installsystems/repository.py +9 −5 Original line number Diff line number Diff line Loading @@ -277,19 +277,23 @@ class Repository(object): r = self.db.ask("select md5 from image where name = ? and version = ? limit 1", (name, version)).fetchone() if r is None: raise Exception("Unable to find image %s version %s" % (name, version)) raise Exception("Unable to find image %s v%s" % (name, version)) path = os.path.join(self.config.path, r[0]) # getting the file arrow("Loading image %s v%s from repository %s" % (name, version, self.config.name)) memfile = cStringIO.StringIO() try: fo = istools.uopen(path) (self.size, self.md5) = istools.copyfileobj(fo, memfile) istools.copyfileobj(fo, memfile) fo.close() except Exception as e: raise Exception("Loading image %s v%s failed: %s" % (name, version, e)) memfile.seek(0) pkg = PackageImage(path, fileobj=memfile, md5name=True) pkg.md5 = r[0] if pkg.md5 != r[0]: raise Exception("Image MD5 verification failure") return pkg def getmd5(self, name, version): Loading Loading
installsystems/image.py +7 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import re import shutil import gzip import gzipstream #until python support gzip not seekable import cStringIO import installsystems.template as istemplate import installsystems.tools as istools from installsystems.printer import * Loading Loading @@ -359,7 +360,12 @@ class PackageImage(Image): try: if fileobj is None: fileobj = istools.uopen(self.path) self._tarball = Tarball.open(fileobj=fileobj, mode='r:gz') memfile = cStringIO.StringIO() fileobj.seek(0) (self.size, self.md5) = istools.copyfileobj(fileobj, memfile) fileobj.close() memfile.seek(0) self._tarball = Tarball.open(fileobj=memfile, mode='r:gz') except Exception as e: raise Exception("Unable to open image %s: %s" % (path, e)) self._metadata = self.read_metadata() Loading
installsystems/repository.py +9 −5 Original line number Diff line number Diff line Loading @@ -277,19 +277,23 @@ class Repository(object): r = self.db.ask("select md5 from image where name = ? and version = ? limit 1", (name, version)).fetchone() if r is None: raise Exception("Unable to find image %s version %s" % (name, version)) raise Exception("Unable to find image %s v%s" % (name, version)) path = os.path.join(self.config.path, r[0]) # getting the file arrow("Loading image %s v%s from repository %s" % (name, version, self.config.name)) memfile = cStringIO.StringIO() try: fo = istools.uopen(path) (self.size, self.md5) = istools.copyfileobj(fo, memfile) istools.copyfileobj(fo, memfile) fo.close() except Exception as e: raise Exception("Loading image %s v%s failed: %s" % (name, version, e)) memfile.seek(0) pkg = PackageImage(path, fileobj=memfile, md5name=True) pkg.md5 = r[0] if pkg.md5 != r[0]: raise Exception("Image MD5 verification failure") return pkg def getmd5(self, name, version): Loading