imgcreate/fs.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit e6767a22aa26c56d7f53c34ef533f3daf70fc373 Author: Jeremy Katz <ka...@redhat.com> Date: Mon Jul 6 14:47:54 2009 -0400 Add a new exception type for resize errors diff --git a/imgcreate/fs.py b/imgcreate/fs.py index cb407ae..ae79b1c 100644 --- a/imgcreate/fs.py +++ b/imgcreate/fs.py @@ -52,9 +52,9 @@ def mksquashfs(in_img, out_img): def resize2fs(fs, size = None, minimal = False): if minimal and size is not None: - raise RuntimeError("Can't specify both minimal and a size for resize!") + raise ResizeError("Can't specify both minimal and a size for resize!") if not minimal and size is None: - raise RuntimeError("Must specify either a size or minimal for resize!") + raise ResizeError("Must specify either a size or minimal for resize!") e2fsck(fs) (fd, saved_image) = tempfile.mkstemp("", "resize-image-", "/tmp") @@ -76,7 +76,7 @@ def resize2fs(fs, size = None, minimal = False): return ret if e2fsck(fs) != 0: - raise CreatorError("fsck after resize returned an error! image to debug at %s" %(saved_image,)) + raise ResizeError("fsck after resize returned an error! image to debug at %s" %(saved_image,)) os.unlink(saved_image) return 0 commit fcad576ac467f6800ef062cd486ac42fa09ac7cd Author: Jeremy Katz <ka...@redhat.com> Date: Mon Jul 6 14:46:20 2009 -0400 Don't continue if the fs unmount fails We occasionally see something where the fs fails to unmount, but we continue anyway. This then leads to weirdness. So just raise an exception if the unmount fails diff --git a/imgcreate/fs.py b/imgcreate/fs.py index c536de3..cb407ae 100644 --- a/imgcreate/fs.py +++ b/imgcreate/fs.py @@ -112,7 +112,9 @@ class BindChrootMount: if not self.mounted: return - subprocess.call(["/bin/umount", self.dest]) + rc = subprocess.call(["/bin/umount", self.dest]) + if rc != 0: + raise MountError("Unable to unmount filesystem at %s" % self.dest) self.mounted = False class LoopbackMount: @@ -354,6 +356,8 @@ class DiskMount(Mount): rc = subprocess.call(["/bin/umount", self.mountdir]) if rc == 0: self.mounted = False + else: + raise MountError("Unable to unmount filesystem at %s" % self.mountdir) if self.rmdir and not self.mounted: try: -- Fedora-livecd-list mailing list Fedora-livecd-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-livecd-list