Skip to content
Snippets Groups Projects
Commit 5a0399d8 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add new wizard mode in snf-image-creator-dialog

Not fully implemented yet
parent 835171dc
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ import os ...@@ -39,6 +39,7 @@ import os
import textwrap import textwrap
import signal import signal
import StringIO import StringIO
import optparse
from image_creator import __version__ as version from image_creator import __version__ as version
from image_creator.util import FatalError, MD5 from image_creator.util import FatalError, MD5
...@@ -608,7 +609,8 @@ def sysprep(session): ...@@ -608,7 +609,8 @@ def sysprep(session):
syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']] syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']]
if len(syspreps) == 0: if len(syspreps) == 0:
d.msgbox("No system preparation task available to run!", title="System Preperation", width=MSGBOX_WIDTH) d.msgbox("No system preparation task available to run!",
title="System Preperation", width=MSGBOX_WIDTH)
return return
while 1: while 1:
...@@ -792,19 +794,26 @@ def select_file(d, media): ...@@ -792,19 +794,26 @@ def select_file(d, media):
return media return media
def wizard(session):
pass
def image_creator(d): def image_creator(d):
basename = os.path.basename(sys.argv[0])
usage = "Usage: %s [input_media]" % basename usage = "Usage: %prog [options] [<input_media>]"
if len(sys.argv) > 2: parser = optparse.OptionParser(version=version, usage=usage)
sys.stderr.write("%s\n" % usage)
return 1 options, args = parser.parse_args(sys.argv[1:])
if len(args) > 1:
parser.error("Wrong numver of arguments")
d.setBackgroundTitle('snf-image-creator') d.setBackgroundTitle('snf-image-creator')
if os.geteuid() != 0: if os.geteuid() != 0:
raise FatalError("You must run %s as root" % basename) raise FatalError("You must run %s as root" % basename)
media = select_file(d, sys.argv[1] if len(sys.argv) == 2 else None) media = select_file(d, args[0] if len(args) == 1 else None)
out = GaugeOutput(d, "Initialization", "Initializing...") out = GaugeOutput(d, "Initialization", "Initializing...")
disk = Disk(media, out) disk = Disk(media, out)
...@@ -846,7 +855,16 @@ def image_creator(d): ...@@ -846,7 +855,16 @@ def image_creator(d):
"image_os": image_os, "image_os": image_os,
"metadata": metadata} "metadata": metadata}
main_menu(session) msg = "Would you like to run the snf-image-creator wizard? " \
"Choose <Yes> if you want to run a wizards to assists " \
"you through the image creation process. Choose <No> to run " \
"the program in expert mode."
if d.yesno(msg, width=YESNO_WIDTH):
main_menu(session)
else:
wizard(session)
d.infobox("Thank you for using snf-image-creator. Bye", width=53) d.infobox("Thank you for using snf-image-creator. Bye", width=53)
finally: finally:
disk.cleanup() disk.cleanup()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment