same change for rotate region

This commit is contained in:
Hossein Shafagh 2021-01-28 15:50:16 -08:00
parent 63e9fdd0e1
commit b80b6d0959
1 changed files with 9 additions and 12 deletions

View File

@ -413,18 +413,15 @@ def rotate_region(endpoint_name, new_certificate_name, old_certificate_name, mes
) )
continue continue
if len(endpoint.certificate.replaced) == 1: log_data["certificate"] = endpoint.certificate.replaced[0].name
log_data["certificate"] = endpoint.certificate.replaced[0].name log_data["message"] = "Rotating all endpoints in region"
log_data["message"] = "Rotating all endpoints in region" if len(endpoint.certificate.replaced) > 1:
print(log_data) log_data["message"] = f"Multiple replacement certificates found, going with the first one out of " \
current_app.logger.info(log_data) f"{len(endpoint.certificate.replaced)}"
request_rotation(endpoint, endpoint.certificate.replaced[0], message, commit)
status = SUCCESS_METRIC_STATUS request_rotation(endpoint, endpoint.certificate.replaced[0], message, commit)
else: print(log_data)
status = FAILURE_METRIC_STATUS current_app.logger.info(log_data)
log_data["message"] = "Failed to rotate endpoint due to Multiple replacement certificates found"
print(log_data)
current_app.logger.info(log_data)
metrics.send( metrics.send(
"endpoint_rotation_region", "endpoint_rotation_region",