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 81ebefa commit 388c593
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('DATABASE_STORAGE') == "s3":
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('DATABASE_STORAGE') == "gcs":
scopes = ['https://www.googleapis.com/auth/devstorage.full_control']
Expand Down

0 comments on commit 388c593

Please sign in to comment.