コード例 #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
ファイル: mixins.py プロジェクト: cirobessa/receitas-aws
 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
ファイル: mixins.py プロジェクト: mcgarrah/euca2ools
    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
ファイル: mixins.py プロジェクト: nephomaniac/euca2ools
    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