Revision cf4f52b6 image_creator/dialog_main.py

b/image_creator/dialog_main.py
265 265
        break
266 266

  
267 267
    out = GaugeOutput(d, "Image Upload", "Uploading...")
268
    if 'checksum' not in session:
269
        md5 = MD5(out)
270
        session['checksum'] = md5.compute(session['snapshot'], size)
271 268
    try:
269
        if 'checksum' not in session:
270
            md5 = MD5(out)
271
            session['checksum'] = md5.compute(session['snapshot'], size)
272 272
        kamaki = Kamaki(session['account'], session['token'], out)
273 273
        try:
274 274
            # Upload image file
......
364 364
def kamaki_menu(session):
365 365
    d = session['dialog']
366 366
    default_item = "Account"
367

  
368
    (session['account'], session['token']) = Kamaki.saved_credentials()
367 369
    while 1:
368 370
        account = session["account"] if "account" in session else "<none>"
369 371
        token = session["token"] if "token" in session else "<none>"
......
395 397
                    del session["account"]
396 398
            else:
397 399
                session["account"] = answer.strip()
400
                Kamaki.save_account(session['account'])
398 401
                default_item = "Token"
399 402
        elif choice == "Token":
400 403
            default_item = "Token"
......
408 411
                del session["token"]
409 412
            else:
410 413
                session["token"] = answer.strip()
414
                Kamaki.save_token(session['account'])
411 415
                default_item = "Upload"
412 416
        elif choice == "Upload":
413 417
            if upload_image(session):
......
855 859
                   "image_os": image_os,
856 860
                   "metadata": metadata}
857 861

  
858
        msg = "Would you like to run the snf-image-creator wizard? " \
859
              "Choose <Yes> if you want to run a wizards to assists " \
860
              "you through the image creation process. Choose <No> to run " \
861
              "the program in expert mode."
862
        msg = "snf-image-creator detected a %s system on the input media. " \
863
              "Would you like to run a wizards to assists you through the " \
864
              "image creation process?\n\nChoose <Yes> to run the wizard, " \
865
              "<No> to run the snf-image-creator in expert mode or press " \
866
              "ESC to quit the program." \
867
              % (dev.ostype if dev.ostype == dev.distro else "%s/%s" %
868
                 (dev.distro, dev.ostype))
869

  
870
        while True:
871
            code = d.yesno(msg, width=YESNO_WIDTH, height=12)
872
            if code == d.DIALOG_OK:
873
                if wizard(session):
874
                    break
875
            elif code == d.DIALOG_CANCEL:
876
                main_menu(session)
877
                break
862 878

  
863
        if d.yesno(msg, width=YESNO_WIDTH):
864
            main_menu(session)
865
        else:
866
            wizard(session)
879
            exit_msg = "You have not selected if you want to run " \
880
                       "snf-image-creator in wizard or expert mode."
881
            if confirm_exit(d, exit_msg):
882
                break
867 883

  
868 884
        d.infobox("Thank you for using snf-image-creator. Bye", width=53)
869 885
    finally:

Also available in: Unified diff