mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage|aws] fix location stuff to allow creating new buckets properly
This commit is contained in:
parent
ce9b00eacf
commit
df6aae8760
1 changed files with 5 additions and 3 deletions
|
@ -36,14 +36,14 @@ module Fog
|
|||
|
||||
def location
|
||||
requires :key
|
||||
@location || bucket_location || self.connection.region
|
||||
attributes[:location] || bucket_location || self.connection.region
|
||||
end
|
||||
|
||||
def location=(new_location)
|
||||
if INVALID_LOCATIONS.include?(new_location)
|
||||
raise ArgumentError, "location must not include any of #{INVALID_LOCATIONS.join(', ')}. See http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html"
|
||||
else
|
||||
@location = new_location
|
||||
merge_attributes(:location => new_location)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,7 +103,9 @@ module Fog
|
|||
|
||||
options['x-amz-acl'] = acl if acl
|
||||
|
||||
options['LocationConstraint'] = location
|
||||
if location = attributes[:location] || (self.connection.region != 'us-east-1' && self.connection.region)
|
||||
options['LocationConstraint'] = location
|
||||
end
|
||||
|
||||
connection.put_bucket(key, options)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue