Cloudfront: Don't add empty Items to list_invalidations (#5699)

This commit is contained in:
Neil Greenwood 2022-11-22 17:23:21 +00:00 committed by GitHub
parent b4f59b771c
commit 4008011a7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -622,6 +622,7 @@ CREATE_INVALIDATION_TEMPLATE = """<?xml version="1.0"?>
INVALIDATIONS_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
<InvalidationList>
<IsTruncated>false</IsTruncated>
{% if invalidations %}
<Items>
{% for invalidation in invalidations %}
<InvalidationSummary>
@ -631,6 +632,7 @@ INVALIDATIONS_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?>
</InvalidationSummary>
{% endfor %}
</Items>
{% endif %}
<Marker></Marker>
<MaxItems>100</MaxItems>
<Quantity>{{ invalidations|length }}</Quantity>

View File

@ -76,4 +76,4 @@ def test_list_invalidations__no_entries():
resp["InvalidationList"].should.have.key("MaxItems").equal(100)
resp["InvalidationList"].should.have.key("IsTruncated").equal(False)
resp["InvalidationList"].should.have.key("Quantity").equal(0)
resp["InvalidationList"].should.have.key("Items").equals([])
resp["InvalidationList"].shouldnt.have.key("Items")