예제 #1
0
파일: mixins.py 프로젝트: Debian/euca2ools
 def ensure_bucket_exists(self, bucket):
     try:
         # Ensure the bucket exists
         req = CheckBucket.from_other(self, service=self.args['s3_service'],
                                      auth=self.args['s3_auth'],
                                      bucket=bucket)
         req.main()
     except ServerError as err:
         if err.status_code == 404:
             # No such bucket
             self.log.info("creating bucket: '%s'", bucket)
             req = CreateBucket.from_other(req, bucket=bucket)
             req.main()
         else:
             raise
예제 #2
0
 def ensure_bucket_exists(self, bucket):
     try:
         # Ensure the bucket exists
         req = CheckBucket.from_other(self,
                                      service=self.args['s3_service'],
                                      auth=self.args['s3_auth'],
                                      bucket=bucket)
         req.main()
     except ServerError as err:
         if err.status_code == 404:
             # No such bucket
             self.log.info("creating bucket: '%s'", bucket)
             req = CreateBucket.from_other(req, bucket=bucket)
             req.main()
         else:
             raise
예제 #3
0
    def ensure_dest_bucket_exists(self):
        if self.args.get('upload_policy'):
            # We won't have creds to sign our own requests
            self.log.info('using an upload policy; not verifying bucket '
                          'existence')
            return

        bucket = self.args['bucket'].split('/', 1)[0]
        try:
            req = CheckBucket.from_other(self, bucket=bucket)
            req.main()
        except AWSError as err:
            if err.status_code == 404:
                # No such bucket
                self.log.info("creating bucket '%s'", bucket)
                req = CreateBucket.from_other(
                    self, bucket=bucket, location=self.args.get('location'))
                req.main()
            else:
                raise
예제 #4
0
    def ensure_dest_bucket_exists(self):
        if self.args.get('upload_policy'):
            # We won't have creds to sign our own requests
            self.log.info('using an upload policy; not verifying bucket '
                          'existence')
            return

        bucket = self.args['bucket'].split('/', 1)[0]
        try:
            req = CheckBucket.from_other(self, bucket=bucket)
            req.main()
        except AWSError as err:
            if err.status_code == 404:
                # No such bucket
                self.log.info("creating bucket '%s'", bucket)
                req = CreateBucket.from_other(
                    self, bucket=bucket, location=self.args.get('location'))
                req.main()
            else:
                raise