Don't execute syspreps if the fs is not mounted rw
[snf-image-creator] / image_creator / dialog_wizard.py
index 5605cc7..17204dc 100644 (file)
@@ -265,6 +265,12 @@ def create_image(session):
 
         #Sysprep
         image.mount(False)
+        err_msg = "Unable to execute the system preparation tasks."
+        if not image.mounted:
+            raise FatalError("%s Couldn't mount the media." % err_msg)
+        elif image.mounted_ro:
+            raise FatalError("%s Couldn't mount the media read-write."
+                             % err_msg)
         image.os.do_sysprep()
         metadata = image.os.meta
         image.umount()