Skip to content

Commit

Permalink
fix(boto): specify the region while getting s3 connection
Browse files Browse the repository at this point in the history
  • Loading branch information
kmala committed Nov 29, 2016
1 parent 6873f66 commit 6e27041
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rootfs/bin/create-bucket
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os

import boto
import boto.s3
import json
import swiftclient
from boto import config as botoconfig
Expand All @@ -19,12 +19,13 @@ def bucket_exists(conn, name):
return True

bucket_name = os.getenv('BUCKET_NAME')
region = os.getenv('AWS_REGION')

if os.getenv('REGISTRY_STORAGE') == "s3" and os.getenv('REGISTRY_STORAGE_S3_BACKEND') != 'minio':
conn = boto.connect_s3()
conn = boto.s3.connect_to_region(region)

if not bucket_exists(conn, bucket_name):
conn.create_bucket(bucket_name)
conn.create_bucket(bucket_name, location=region)

elif os.getenv('REGISTRY_STORAGE') == "gcs":
scopes = ['https://www.googleapis.com/auth/devstorage.full_control']
Expand Down

0 comments on commit 6e27041

Please sign in to comment.