Fixes acm:describe_certificate for imported certificates having no SAN extension (#3370)

* Fix(test_acm): describe_certificate testcase does't execute

* handle acm certificates lacking extensions

Co-authored-by: nom3ad <nom3ad@gmail.com>
This commit is contained in:
nom3ad 2020-10-11 03:02:42 +05:30 committed by GitHub
parent c54f182ca1
commit 502818be4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -293,9 +293,12 @@ class CertBundle(BaseModel):
key_algo = "EC_prime256v1"
# Look for SANs
san_obj = self._cert.extensions.get_extension_for_oid(
cryptography.x509.OID_SUBJECT_ALTERNATIVE_NAME
)
try:
san_obj = self._cert.extensions.get_extension_for_oid(
cryptography.x509.OID_SUBJECT_ALTERNATIVE_NAME
)
except cryptography.x509.ExtensionNotFound:
san_obj = None
sans = []
if san_obj is not None:
sans = [item.value for item in san_obj.value]

View File

@ -140,7 +140,7 @@ def test_describe_certificate():
@mock_acm
def test_describe_certificate():
def test_describe_certificate_with_bad_arn():
client = boto3.client("acm", region_name="eu-central-1")
try: