# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
-import sys
import os
import textwrap
import StringIO
]
-class metadata_monitor(object):
+class MetadataMonitor(object):
def __init__(self, session, meta):
self.session = session
self.meta = meta
def upload_image(session):
d = session["dialog"]
dev = session['device']
+ meta = session['metadata']
size = dev.size
if "account" not in session:
- d.msgbox("You need to provide your ~okeanos account before you "
+ d.msgbox("You need to provide your ~okeanos credentials before you "
"can upload images to pithos+", width=SMALL_WIDTH)
return False
while 1:
- init = session["upload"] if "upload" in session else ''
+ if 'upload' in session:
+ init = session['upload']
+ elif 'OS' in meta:
+ init = "%s.diskdump" % meta['OS']
+ else:
+ init = ""
(code, answer) = d.inputbox("Please provide a filename:", init=init,
width=WIDTH)
if "account" not in session:
d.msgbox("You need to provide your ~okeanos credentians before you "
- "can register an images to cyclades",
+ "can register an images with cyclades",
width=SMALL_WIDTH)
return False
if "pithos_uri" not in session:
d.msgbox("You need to upload the image to pithos+ before you can "
- "register it to cyclades", width=SMALL_WIDTH)
+ "register it with cyclades", width=SMALL_WIDTH)
return False
while 1:
d.msgbox("Registration name cannot be empty", width=SMALL_WIDTH)
continue
- ret = d.yesno("Make the image public?\\nA public image is accessible"
+ ret = d.yesno("Make the image public?\\nA public image is accessible "
"by every user of the service.", defaultno=1,
width=WIDTH)
if ret not in (0, 1):
if choice == "Account":
default_item = "Account"
(code, answer) = d.inputbox(
- "Please provide your ~okeanos token:",
+ "Please provide your ~okeanos authentication token:",
init=session["account"]['auth_token'] if "account" in session
else '', width=WIDTH)
if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
del session['checksum']
# Monitor the metadata changes during syspreps
- with metadata_monitor(session, image_os.meta):
+ with MetadataMonitor(session, image_os.meta):
image_os.do_sysprep()
infobox.finalize()
if not d.yesno("%s\n\nDo you want to continue?" % msg, width=WIDTH,
height=12, title="Image Shrinking"):
- with metadata_monitor(session, dev.meta):
+ with MetadataMonitor(session, dev.meta):
infobox = InfoBoxOutput(d, "Image Shrinking", height=4)
dev.out.add(infobox)
try:
def main_menu(session):
d = session['dialog']
- dev = session['device']
update_background_title(session)
d.infobox("Resetting snf-image-creator. Please wait...",
width=SMALL_WIDTH)
raise Reset
+ elif choice == "Help":
+ d.msgbox("For help, check the online documentation:\n\nhttp://www"
+ ".synnefo.org/docs/snf-image-creator/latest/",
+ width=WIDTH, title="Help")
elif choice in actions:
actions[choice](session)