X-Git-Url: https://code.grnet.gr/git/snf-image-creator/blobdiff_plain/ee0719db894b7d2aaa6e6a7e3f97d477dd8dca4f..ef30380dbc20f38dbcc0a483c20c991745c72555:/image_creator/kamaki_wrapper.py diff --git a/image_creator/kamaki_wrapper.py b/image_creator/kamaki_wrapper.py index 3f809d0..e2012d2 100644 --- a/image_creator/kamaki_wrapper.py +++ b/image_creator/kamaki_wrapper.py @@ -117,4 +117,21 @@ class Kamaki(object): params = {'is_public': is_public, 'disk_format': 'diskdump'} self.image_client.register(name, location, params, str_metadata) + def share(self, location): + """Share this file with all the users""" + + self.pithos_client.set_object_sharing(location, "*") + + def object_exists(self, location): + """Check if an object exists in pythos""" + + try: + self.pithos_client.get_object_info(location) + except ClientError as e: + if e.status == 404: # Object not found error + return False + else: + raise + return True + # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :