@@ -27,17 +27,17 @@ if os.getenv('DATABASE_STORAGE') == "s3":
2727 if not bucket_exists (conn , bucket_name ):
2828 try :
2929 conn .create_bucket (bucket_name , location = region )
30+ # NOTE(bacongobbler): for versions prior to v2.9.0, the bucket is created in the default region.
31+ # if we got here, we need to propagate "us-east-1" into WALE_S3_ENDPOINT because the bucket
32+ # exists in a different region and we cannot find it.
33+ # TODO(bacongobbler): deprecate this once we drop support for v2.8.0 and lower
3034 except S3CreateError as err :
31- # try again in the default S3 region before giving up
32- default_region = 'us-east-1'
33- if region != default_region :
34- print ('Failed to create bucket in {}, trying default region {}...' .format (
35- region , default_region ))
36- conn = boto .s3 .connect_to_region (default_region )
37- if not bucket_exists (conn , bucket_name ):
38- conn .create_bucket (bucket_name , location = default_region )
39- # TODO: if we got here, somehow we need to propagate "us-east-1"
40- # into WALE_S3_ENDPOINT...
35+ if region != 'us-east-1' :
36+ print ('Failed to create bucket in {}. We are now assuming that the bucket was created in us-east-1.' .format (region ))
37+ with open (os .path .join (os .environ ['WALE_ENVDIR' ], "WALE_S3_ENDPOINT" ), "w+" ) as file :
38+ file .write ('https+path://s3.amazonaws.com:443' )
39+ else :
40+ raise
4141
4242elif os .getenv ('DATABASE_STORAGE' ) == "gcs" :
4343 scopes = ['https://www.googleapis.com/auth/devstorage.full_control' ]
0 commit comments