Loading installsystems/image.py +42 −29 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ class SourceImage(Image): arrow("Creating image tarball") arrowlevel(1) arrow("Name %s" % self.image_name) try: try: tarball = Tarball.open(self.image_name, mode="w:gz", dereference=True) except Exception as e: Loading @@ -202,6 +203,9 @@ class SourceImage(Image): self._add_scripts(tarball, self.setup_path) # closing tarball file tarball.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(self.image_name): os.unlink(self.image_name) arrowlevel(-1) def create_payloads(self, force=False): Loading Loading @@ -268,6 +272,10 @@ class SourceImage(Image): filter=self._create_payload_tarball_filter) tarball.close() dfo.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(tar_path): os.unlink(tar_path) raise except Exception as e: raise Exception("Unable to create payload tarball %s: %s" % (tar_path, e)) Loading @@ -285,6 +293,7 @@ class SourceImage(Image): Create a payload file Only gzipping it ''' try: fsource = PipeFile(source, "r", progressbar=True) # open file not done in GzipFile, to escape writing of filename # in gzip file. This change md5. Loading @@ -295,6 +304,10 @@ class SourceImage(Image): fsource.consume(fdest) fsource.close() fdest.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(dest): os.unlink(dest) raise def _add_scripts(self, tarball, directory): ''' Loading Loading
installsystems/image.py +42 −29 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ class SourceImage(Image): arrow("Creating image tarball") arrowlevel(1) arrow("Name %s" % self.image_name) try: try: tarball = Tarball.open(self.image_name, mode="w:gz", dereference=True) except Exception as e: Loading @@ -202,6 +203,9 @@ class SourceImage(Image): self._add_scripts(tarball, self.setup_path) # closing tarball file tarball.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(self.image_name): os.unlink(self.image_name) arrowlevel(-1) def create_payloads(self, force=False): Loading Loading @@ -268,6 +272,10 @@ class SourceImage(Image): filter=self._create_payload_tarball_filter) tarball.close() dfo.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(tar_path): os.unlink(tar_path) raise except Exception as e: raise Exception("Unable to create payload tarball %s: %s" % (tar_path, e)) Loading @@ -285,6 +293,7 @@ class SourceImage(Image): Create a payload file Only gzipping it ''' try: fsource = PipeFile(source, "r", progressbar=True) # open file not done in GzipFile, to escape writing of filename # in gzip file. This change md5. Loading @@ -295,6 +304,10 @@ class SourceImage(Image): fsource.consume(fdest) fsource.close() fdest.close() except (SystemExit, KeyboardInterrupt): if os.path.exists(dest): os.unlink(dest) raise def _add_scripts(self, tarball, directory): ''' Loading