+
+ distro = session['image'].distro
+ ostype = session['image'].ostype
+
+ def cloud_choices():
+ choices = []
+ for (name, cloud) in Kamaki.get_clouds().items():
+ descr = cloud['description'] if 'description' in cloud else ''
+ choices.append((name, descr))
+
+ return choices
+
+ def cloud_add():
+ return add_cloud(session)
+
+ def cloud_none_available():
+ if not session['dialog'].yesno(
+ "No available clouds found. Would you like to add one now?",
+ width=PAGE_WIDTH, defaultno=0):
+ return add_cloud(session)
+ return False
+
+ def cloud_validate(cloud):
+ if not Kamaki.get_account(cloud):
+ if not session['dialog'].yesno(
+ "The cloud you have selected is not valid! Would you "
+ "like to edit it now?", width=PAGE_WIDTH, defaultno=0):
+ if edit_cloud(session, cloud):
+ return cloud
+
+ raise WizardInvalidData
+
+ return cloud
+
+ cloud = WizardMenuPage(
+ "Cloud", "Cloud",
+ "Please select a cloud account or press <Add> to add a new one:",
+ choices=cloud_choices, extra_label="Add", extra=cloud_add,
+ title="Clouds", validate=cloud_validate, fallback=cloud_none_available)