Revision 8e58e699 image_creator/main.py
b/image_creator/main.py | ||
---|---|---|
49 | 49 |
import optparse |
50 | 50 |
import StringIO |
51 | 51 |
import signal |
52 |
import json |
|
52 | 53 |
|
53 | 54 |
|
54 | 55 |
def check_writable_dir(option, opt_str, value, parser): |
... | ... | |
280 | 281 |
md5 = MD5(out) |
281 | 282 |
checksum = md5.compute(image.device, size) |
282 | 283 |
|
283 |
metastring = '\n'.join(
|
|
284 |
['%s=%s' % (key, value) for (key, value) in metadata.items()])
|
|
285 |
metastring += '\n'
|
|
284 |
metastring = unicode(json.dumps(
|
|
285 |
{'properties': metadata,
|
|
286 |
'disk-format': 'diskdump'}, ensure_ascii=False))
|
|
286 | 287 |
|
287 | 288 |
if options.outfile is not None: |
288 | 289 |
image.dump(options.outfile) |
... | ... | |
324 | 325 |
img_type = 'public' if options.public else 'private' |
325 | 326 |
out.output('Registering %s image with ~okeanos ...' % img_type, |
326 | 327 |
False) |
327 |
kamaki.register(options.register, uploaded_obj, metadata,
|
|
328 |
options.public) |
|
328 |
result = kamaki.register(options.register, uploaded_obj,
|
|
329 |
metadata, options.public)
|
|
329 | 330 |
out.success('done') |
330 | 331 |
out.output("Uploading metadata file ...", False) |
332 |
metastring = unicode(json.dumps(result, ensure_ascii=False)) |
|
331 | 333 |
kamaki.upload(StringIO.StringIO(metastring), |
332 | 334 |
size=len(metastring), |
333 | 335 |
remote_path="%s.%s" % (options.upload, 'meta')) |
Also available in: Unified diff