d = session["dialog"]
dev = session['device']
+ is_public = False
+
if "account" not in session:
- d.msgbox("You need to provide your ~okeanos login username before you "
+ d.msgbox("You need to provide your ~okeanos credentians before you "
"can register an images to cyclades",
width=SMALL_WIDTH)
return False
if len(name) == 0:
d.msgbox("Registration name cannot be empty", width=SMALL_WIDTH)
continue
+
+ 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):
+ continue
+
+ is_public = True if ret == 0 else False
+
break
metadata = {}
for key in session['task_metadata']:
metadata[key] = 'yes'
+ img_type = "public" if is_public else "private"
gauge = GaugeOutput(d, "Image Registration", "Registering image...")
try:
out = dev.out
out.add(gauge)
try:
- out.output("Registering image with Cyclades...")
+ out.output("Registering %s image with Cyclades..." % img_type)
try:
kamaki = Kamaki(session['account'], out)
- kamaki.register(name, session['pithos_uri'], metadata)
+ kamaki.register(name, session['pithos_uri'], metadata,
+ is_public)
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 with Cyclades as `%s'" %
- (session['upload'], name), width=SMALL_WIDTH)
+ d.msgbox("%s image `%s' was successfully registered with Cyclades as `%s'"
+ % (img_type.title(), session['upload'], name), width=SMALL_WIDTH)
return True
else:
del session['account']
d.msgbox("The token you provided is not valid!",
- width=SMALL_WIDTH)
+ width=SMALL_WIDTH)
elif choice == "Upload":
if upload_image(session):
default_item = "Register"