capturing no such entity exception.
This commit is contained in:
parent
8aea257e6a
commit
1768aad9e2
|
@ -10,7 +10,7 @@ import botocore
|
|||
|
||||
from retrying import retry
|
||||
|
||||
from lemur.extensions import metrics
|
||||
from lemur.extensions import metrics, sentry
|
||||
from lemur.plugins.lemur_aws.sts import sts_client
|
||||
|
||||
|
||||
|
@ -122,9 +122,11 @@ def get_certificate(name, **kwargs):
|
|||
"""
|
||||
client = kwargs.pop("client")
|
||||
metrics.send("get_certificate", "counter", 1, metric_tags={"name": name})
|
||||
return client.get_server_certificate(ServerCertificateName=name)[
|
||||
"ServerCertificate"
|
||||
]
|
||||
try:
|
||||
return client.get_server_certificate(ServerCertificateName=name)["ServerCertificate"]
|
||||
except client.exceptions.NoSuchEntityException:
|
||||
sentry.captureException()
|
||||
return None
|
||||
|
||||
|
||||
@sts_client("iam")
|
||||
|
|
|
@ -280,6 +280,7 @@ class AWSSourcePlugin(SourcePlugin):
|
|||
certificate_name = certificate_name.split('/')[1]
|
||||
try:
|
||||
cert = iam.get_certificate(certificate_name, account_number=account_number)
|
||||
if cert:
|
||||
return dict(
|
||||
body=cert["CertificateBody"],
|
||||
chain=cert.get("CertificateChain"),
|
||||
|
|
Loading…
Reference in New Issue