diff --git a/lib/fog/aws/models/s3/bucket.rb b/lib/fog/aws/models/s3/bucket.rb index dabd1b372..0850e6d25 100644 --- a/lib/fog/aws/models/s3/bucket.rb +++ b/lib/fog/aws/models/s3/bucket.rb @@ -16,7 +16,9 @@ module Fog end def delete + return false if new_record? connection.delete_bucket(name) + @new_record = true true end @@ -45,6 +47,7 @@ module Fog options['LocationConstraint'] = @location end connection.put_bucket(name, options) + @new_record = false true end diff --git a/lib/fog/model.rb b/lib/fog/model.rb index 9f616ca56..007512aa5 100644 --- a/lib/fog/model.rb +++ b/lib/fog/model.rb @@ -25,6 +25,10 @@ module Fog @connection end + def new_record? + !defined?(@new_record) || @new_record + end + def remap_attributes(attributes, mapping) for key, value in mapping if attributes[key]