X-Git-Url: https://code.grnet.gr/git/snf-image-creator/blobdiff_plain/b13959674094c57ea0b5dce1164da4819bbcfe3c..5886f568337cad55facff1132344374553bd8b1f:/image_creator/kamaki_wrapper.py diff --git a/image_creator/kamaki_wrapper.py b/image_creator/kamaki_wrapper.py index f325be0..e3c249e 100644 --- a/image_creator/kamaki_wrapper.py +++ b/image_creator/kamaki_wrapper.py @@ -53,6 +53,10 @@ def progress(message): progressbar = Bar(msg.ljust(MSG_LENGTH)) progressbar.max = n + progressbar.fill = '#' + progressbar.bar_prefix = ' [' + progressbar.bar_suffix = '] ' + for _ in range(n): yield progressbar.next() @@ -61,6 +65,7 @@ def progress(message): yield return progress_gen + class Kamaki: def __init__(self, account, token): self.account = account @@ -79,7 +84,7 @@ class Kamaki: self.uploaded_object = None def upload(self, file_obj, size=None, remote_path=None, hp=None, up=None): - + """Upload a file to pithos""" if remote_path is None: remote_path = basename(filename) @@ -100,7 +105,8 @@ class Kamaki: raise FatalError("Pithos client: %d %s" % (e.status, e.message)) def register(self, name, location, metadata): - params = {'is_public':'true', 'disk_format':'diskdump'} + """Register an image to ~okeanos""" + params = {'is_public': 'true', 'disk_format': 'diskdump'} try: self.image_client.register(name, location, params, metadata) except ClientError as e: