help="Use this ACCOUNT when uploading/registring images [Default: %s]"\
% account)
+ parser.add_option("-m", "--metadata", dest="metadata", default=[],
+ help="Add custom KEY=VALUE metadata to the image", action="append",
+ metavar="KEY=VALUE")
+
parser.add_option("-t", "--token", dest="token", type="string",
default=token,
help="Use this token when uploading/registring images [Default: %s]"\
if len(args) != 1:
parser.error('Wrong number of arguments')
+
options.source = args[0]
if not os.path.exists(options.source):
raise FatalError("Input media `%s' is not accessible" % options.source)
raise FatalError("Image uploading cannot be performed. No ~okeanos "
"token is specified. User -t to set a token.")
+ meta = {}
+ for m in options.metadata:
+ try:
+ key, value = m.split('=', 1)
+ except ValueError:
+ raise FatalError("Metadata option: `%s' is not in "\
+ "KEY=VALUE format." % m)
+ meta[key] = value
+ options.metadata = meta
+
return options
size = options.shrink and dev.shrink() or dev.size
metadata.update(dev.meta)
+ # Add command line metadata to the collected ones...
+ metadata.update(options.metadata)
+
checksum = md5(snapshot, size)
metastring = '\n'.join(