diff options
-rwxr-xr-x | mic/imager/baseimager.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index 9c2b30d..ec2edb5 100755 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -33,7 +33,7 @@ import rpm import time from mic import kickstart from mic import msger, __version__ as VERSION -from mic.utils.errors import CreatorError, Abort +from mic.utils.errors import CreatorError, KsError, Abort from mic.utils import misc, grabber, runner, fs_related as fs from mic.chroot import kill_proc_inchroot from mic.archive import get_archive_suffixes @@ -155,8 +155,11 @@ class BaseImageCreator(object): if part.fstype and part.fstype == "btrfs": self._dep_checks.append("mkfs.btrfs") break - if part.fstype == "cpio": - part.fstype = "ext4" + if part.cpioopts: + if part.fstype == "cpio": + part.fstype = "ext4" + else: + raise KsError("The '--fstype' in ks file need to set 'cpio' when you want to generate image by cpio.") if len(self.ks.handler.partition.partitions) > 1: self.multiple_partitions = True @@ -1330,7 +1333,7 @@ class BaseImageCreator(object): runner.show('find . | cpio --create %s | gzip > %s' % (item['cpioopts'], tmp_cpio_imgfile)) os.chdir(oldoutdir) except OSError, (errno, msg): - raise errors.CreatorError("Create image by cpio error: %s" % msg) + raise CreatorError("Create image by cpio error: %s" % msg) def copy_cpio_image(self): for item in self._instloops: @@ -1340,7 +1343,7 @@ class BaseImageCreator(object): try: shutil.copyfile(os.path.join(tmp_cpio, item['name']),os.path.join(self._imgdir, item['name'])) except IOError: - raise errors.CreatorError("Copy cpio image error") + raise CreatorError("Copy cpio image error") os.remove(os.path.join(tmp_cpio, item['name'])) if not os.listdir(tmp_cpio): shutil.rmtree(tmp_cpio, ignore_errors=True) |