Further development in bundle_volume
[snf-image-creator] / image_creator / dialog_wizard.py
index f0a01f4..a66cf38 100644 (file)
@@ -175,6 +175,13 @@ class WizardYesNoPage(WizardPage):
 
 
 def wizard(session):
+    init_account = Kamaki.get_account()
+    if init_account is None:
+        init_account = ""
+
+    init_token = Kamaki.get_token()
+    if init_token is None:
+        init_token = ""
 
     name = WizardInputPage("ImageName", "Please provide a name for the image:",
                            title="Image Name", init=session['device'].distro)
@@ -186,11 +193,11 @@ def wizard(session):
     account = WizardInputPage("account",
                               "Please provide your ~okeanos account e-mail:",
                               title="~okeanos account information",
-                              init=Kamaki.get_account())
+                              init=init_account)
     token = WizardInputPage("token",
                             "Please provide your ~okeanos account token:",
                             title="~okeanos account token",
-                            init=Kamaki.get_token())
+                            init=init_token)
 
     msg = "All necessary information has been gathered. Confirm and Proceed."
     proceed = WizardYesNoPage(msg, title="Confirmation")
@@ -219,6 +226,10 @@ def create_image(session):
     image_os = session['image_os']
     wizard = session['wizard']
 
+    # Save Kamaki credentials
+    Kamaki.save_account(wizard['account'])
+    Kamaki.save_token(wizard['token'])
+
     with_progress = OutputWthProgress(True)
     out = disk.out
     out.add(with_progress)