add cert_expires_at
This commit is contained in:
@@ -52,14 +52,14 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
# Key pattern `CERT#REPORTING#ORG#{org_id}`
|
||||
*_, org_id = old_image['id'].split('#')
|
||||
event_name = old_image['sk']
|
||||
target_month = datetime.strptime(old_image['target_month'], '%Y-%m').date()
|
||||
month = _monthfmt(target_month)
|
||||
target_month = old_image['target_month']
|
||||
pretty_month = _monthfmt(datetime.strptime(target_month, '%Y-%m').date())
|
||||
now_ = now()
|
||||
|
||||
result = enrollment_layer.collection.query(
|
||||
r = enrollment_layer.collection.query(
|
||||
KeyPair(
|
||||
pk=old_image['id'],
|
||||
sk='MONTH#{}#ENROLLMENT'.format(target_month.strftime('%Y-%m')),
|
||||
sk=f'MONTH#{target_month}#ENROLLMENT',
|
||||
),
|
||||
limit=150,
|
||||
)
|
||||
@@ -68,8 +68,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
{
|
||||
'template_uri': CERT_REPORTING_URI,
|
||||
'args': {
|
||||
'month': month,
|
||||
'items': result['items'],
|
||||
'month': pretty_month,
|
||||
'items': r['items'],
|
||||
},
|
||||
},
|
||||
cls=Encoder,
|
||||
@@ -83,14 +83,14 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
to=_get_admin_emails(org_id),
|
||||
reply_to=REPLY_TO,
|
||||
bcc=BCC,
|
||||
subject=SUBJECT.format(month=month),
|
||||
subject=SUBJECT.format(month=pretty_month),
|
||||
)
|
||||
emailmsg.add_alternative(MESSAGE.format(month=month))
|
||||
emailmsg.add_alternative(MESSAGE.format(month=pretty_month))
|
||||
attachment = MIMEApplication(r.content)
|
||||
attachment.add_header(
|
||||
'Content-Disposition',
|
||||
'attachment',
|
||||
filename='{}.pdf'.format(target_month.strftime('%Y-%m')),
|
||||
filename=f'{target_month}.pdf',
|
||||
)
|
||||
emailmsg.attach(attachment)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user