Delete old 'process-virus-scan-passed-task'

This has been replaced by a new task, `sanitise-letter`, to this deletes
all the code in the old task and ensures that when antivirus is not
enabled locally we are calling the new task.
This commit is contained in:
Katie Smith
2020-03-10 15:15:58 +00:00
parent e07dea27e1
commit 6ac89c9a2f
5 changed files with 12 additions and 531 deletions

View File

@@ -114,14 +114,6 @@ def move_failed_pdf(source_filename, scan_error_type):
_move_s3_object(scan_bucket, source_filename, scan_bucket, target_filename)
def copy_redaction_failed_pdf(source_filename):
scan_bucket = current_app.config['LETTERS_SCAN_BUCKET_NAME']
target_filename = 'REDACTION_FAILURE/' + source_filename
_copy_s3_object(scan_bucket, source_filename, scan_bucket, target_filename)
def move_error_pdf_to_scan_bucket(source_filename):
scan_bucket = current_app.config['LETTERS_SCAN_BUCKET_NAME']
error_file = 'ERROR/' + source_filename
@@ -213,22 +205,6 @@ def _move_s3_object(source_bucket, source_filename, target_bucket, target_filena
source_bucket, source_filename, target_bucket, target_filename))
def _copy_s3_object(source_bucket, source_filename, target_bucket, target_filename):
s3 = boto3.resource('s3')
copy_source = {'Bucket': source_bucket, 'Key': source_filename}
target_bucket = s3.Bucket(target_bucket)
obj = target_bucket.Object(target_filename)
# Tags are copied across but the expiration time is reset in the destination bucket
# e.g. if a file has 5 days left to expire on a ONE_WEEK retention in the source bucket,
# in the destination bucket the expiration time will be reset to 7 days left to expire
obj.copy(copy_source, ExtraArgs={'ServerSideEncryption': 'AES256'})
current_app.logger.info("Copied letter PDF: {}/{} to {}/{}".format(
source_bucket, source_filename, target_bucket, target_filename))
def letter_print_day(created_at):
bst_print_datetime = convert_utc_to_bst(created_at) + timedelta(hours=6, minutes=30)
bst_print_date = bst_print_datetime.date()