from image_creator import __version__ as version
from image_creator.util import FatalError, MD5
-from image_creator.output import Output, CombinedOutput
+from image_creator.output import Output
from image_creator.output.cli import SimpleOutput
from image_creator.output.dialog import GaugeOutput, InfoBoxOutput
+from image_creator.output.composite import CompositeOutput
from image_creator.disk import Disk
from image_creator.os_type import os_cls
from image_creator.kamaki_wrapper import Kamaki, ClientError
if len(filename) == 0:
d.msgbox("Filename cannot be empty", width=MSGBOX_WIDTH)
continue
-
+ session['upload'] = filename
break
gauge = GaugeOutput(d, "Image Upload", "Uploading...")
try:
# Upload image file
with open(session['snapshot'], 'rb') as f:
- session["upload"] = kamaki.upload(f, size, filename,
+ session["pithos_uri"] = kamaki.upload(f, size, filename,
"Calculating block hashes",
"Uploading missing blocks")
# Upload metadata file
except ClientError as e:
d.msgbox("Error in pithos+ client: %s" % e.message,
title="Pithos+ Client Error", width=MSGBOX_WIDTH)
- if 'upload' in session:
- del session['upload']
+ if 'pithos_uri' in session:
+ del session['pithos_uri']
return False
finally:
out.remove(gauge)
width=MSGBOX_WIDTH)
return False
- if "upload" not in session:
+ if "pithos_uri" not in session:
d.msgbox("You need to upload the image to pithos+ before you can "
"register it to cyclades", width=MSGBOX_WIDTH)
return False
for key in session['task_metadata']:
metadata[key] = 'yes'
- gauge = GaugeOutput(d, "Image Registration", "Registrating image...")
+ gauge = GaugeOutput(d, "Image Registration", "Registering image...")
try:
out = dev.out
out.add(gauge)
try:
- out.output("Registring image to cyclades...")
+ out.output("Registering image with Cyclades...")
try:
kamaki = Kamaki(session['account'], session['token'], out)
- kamaki.register(name, session['upload'], metadata)
+ kamaki.register(name, session['pithos_uri'], metadata)
out.success('done')
except ClientError as e:
d.msgbox("Error in pithos+ client: %s" % e.message)
finally:
gauge.cleanup()
- d.msgbox("Image `%s' was successfully registered to cyclades as `%s'" %
+ d.msgbox("Image `%s' was successfully registered with Cyclades as `%s'" %
(session['upload'], name), width=MSGBOX_WIDTH)
return True
del session["token"]
else:
session["token"] = answer.strip()
- Kamaki.save_token(session['account'])
+ Kamaki.save_token(session['token'])
default_item = "Upload"
elif choice == "Upload":
if upload_image(session):
index += 1
(code, tags) = d.checklist(
- "Please choose which system preperation tasks you would like to "
+ "Please choose which system preparation tasks you would like to "
"run on the image. Press <Help> to see details about the system "
- "preperation tasks.", title="Run system preperation tasks",
+ "preparation tasks.", title="Run system preparation tasks",
choices=choices, width=70, ok_label="Run", help_button=1)
if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
def customization_menu(session):
d = session['dialog']
- choices = [("Sysprep", "Run various image preperation tasks"),
+ choices = [("Sysprep", "Run various image preparation tasks"),
("Shrink", "Shrink image"),
("View/Modify", "View/Modify image properties"),
("Delete", "Delete image properties"),
"metadata": metadata}
msg = "snf-image-creator detected a %s system on the input media. " \
- "Would you like to run a wizards to assists you through the " \
- "image creation process?\n\nChoose <Yes> to run the wizard, " \
- "<No> to run the snf-image-creator in expert mode or press " \
+ "Would you like to run a wizard to assist you through the " \
+ "image creation process?\n\nChoose <Wizard> to run the wizard," \
+ " <Expert> to run the snf-image-creator in expert mode or press " \
"ESC to quit the program." \
% (dev.ostype if dev.ostype == dev.distro else "%s (%s)" %
(dev.ostype, dev.distro))
update_background_title(session)
while True:
- code = d.yesno(msg, width=YESNO_WIDTH, height=12)
+ code = d.yesno(msg, width=YESNO_WIDTH, height=12,
+ yes_label="Wizard", no_label="Expert")
if code == d.DIALOG_OK:
if wizard(session):
break
dialog._common_args_syntax["extra_label"] = \
lambda string: ("--extra-label", string)
+ # Allow yes-no label overwriting
+ dialog._common_args_syntax["yes_label"] = \
+ lambda string: ("--yes-label", string)
+
+ dialog._common_args_syntax["no_label"] = \
+ lambda string: ("--no-label", string)
+
usage = "Usage: %prog [options] [<input_media>]"
parser = optparse.OptionParser(version=version, usage=usage)
parser.add_option("-l", "--logfile", type="string", dest="logfile",
else Output()
while 1:
try:
- out = CombinedOutput([log])
- out.output("Starting %s version %s..." % \
+ out = CompositeOutput([log])
+ out.output("Starting %s v%s..." % \
(parser.get_prog_name(), version))
ret = image_creator(d, media, out)
sys.exit(ret)