Example #1
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
Example #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
Example #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
Example #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