diff --git a/image_creator/dialog_menu.py b/image_creator/dialog_menu.py
index 0e32167ca8b579e50193bebf9930d26462070314..dc0c31b8037194c85efb031cb7d59ac413f52d68 100644
--- a/image_creator/dialog_menu.py
+++ b/image_creator/dialog_menu.py
@@ -554,6 +554,18 @@ def sysprep(session):
try:
image.mount(readonly=False)
try:
+ err_msg = \
+ "Unable to execute the system preparation tasks."
+ if not image.mounted:
+ d.msgbox("%s Couldn't mount the media." % err_msg,
+ title="System Preperation", width=SMALL_WIDTH)
+ return
+ elif image.mounted_ro:
+ d.msgbox("%s Couldn't mount the media read-write."
+ % err_msg, title="System Preperation",
+ width=SMALL_WIDTH)
+ return
+
# The checksum is invalid. We have mounted the image rw
if 'checksum' in session:
del session['checksum']
diff --git a/image_creator/dialog_wizard.py b/image_creator/dialog_wizard.py
index 5605cc756e7f8b40b8a52d42de7a2a2e67d96678..17204dc8b6a02ecedda205ad85f571cf8293fc5f 100644
--- a/image_creator/dialog_wizard.py
+++ b/image_creator/dialog_wizard.py
@@ -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()
diff --git a/image_creator/main.py b/image_creator/main.py
index 4b86f7c7d42fffdbb54b6b67ee661077778b4467..130f50a8799b7685a6de261fe70e611000d4ee67 100644
--- a/image_creator/main.py
+++ b/image_creator/main.py
@@ -224,6 +224,12 @@ def image_creator():
return 0
if options.sysprep:
+ err_msg = "Unable to apply 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