Skip to content

Commit

Permalink
Add logger to task
Browse files Browse the repository at this point in the history
  • Loading branch information
BasilMawejje committed Oct 12, 2021
1 parent b07c5e6 commit e822de8
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions lib/tasks/shf_aws.rake
Original file line number Diff line number Diff line change
Expand Up @@ -142,27 +142,31 @@ namespace :shf do

storage_rules = [{days: 90, storage_class: 'GLACIER'}, {days: 450, storage_class: 'DEEP_ARCHIVE'}]

aws_client.put_bucket_lifecycle_configuration({
bucket: aws_s3_backup_bucket_name,
lifecycle_configuration: {
rules: [
{
expiration: {
date: Time.now,
days: 3650,
expired_object_delete_marker: false
},
id: aws_s3_backup_bucket_id.to_s,
prefix: aws_s3_backup_bucket_full_prefix,
filter: {
prefix: aws_s3_backup_bucket_full_prefix
},
status: 'Enabled',
transitions: storage_rules
}
]
}
})
ActivityLogger.open(LogfileNamer.name_for(LOGFILENAME), LOG_FACILITY, 'Add bucket lifecycle configuration') do |log|
aws_client.put_bucket_lifecycle_configuration({
bucket: aws_s3_backup_bucket_name,
lifecycle_configuration: {
rules: [
{
expiration: {
date: Time.now,
days: 3650,
expired_object_delete_marker: false
},
id: aws_s3_backup_bucket_id.to_s,
prefix: aws_s3_backup_bucket_full_prefix,
filter: {
prefix: aws_s3_backup_bucket_full_prefix
},
status: 'Enabled',
transitions: storage_rules
}
]
}
})

log.info("Lifecycle configuration added for #{aws_s3_backup_bucket_name}")
end
end
end
end
Expand Down

0 comments on commit e822de8

Please sign in to comment.