Commit 84bc469c authored by Nikos Skalkotos's avatar Nikos Skalkotos

Don't execute syspreps if the fs is not mounted rw

Check if the filesystem is mounted read-write before you execute
the do_sysprep function
parent 29fd973e
......@@ -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']
......
......@@ -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()
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment