FIX: error setting tombstone bucket when set to old version

This commit is contained in:
Sam
2017-11-13 15:36:45 +11:00
parent 232311aa8c
commit 4f28c71b50
2 changed files with 63 additions and 3 deletions

View File

@ -100,12 +100,24 @@ class S3Helper
# skip trying to merge
end
# in the past we has a rule that was called purge-tombstone vs purge_tombstone
# just go ahead and normalize for our bucket
rules.delete_if do |r|
r.id == id
r.id.gsub('_', '-') == id.gsub('_', '-')
end
rules << rule
# normalize filter in rules, due to AWS library bug
rules = rules.map do |r|
r = r.to_h
prefix = r.delete(:prefix)
if prefix
r[:filter] = { prefix: prefix }
end
r
end
s3_resource.client.put_bucket_lifecycle_configuration(
bucket: @s3_bucket_name,
lifecycle_configuration: {