CloudFront: Bug distribution with tags (#5467)
This commit is contained in:
parent
2c2b1c76fa
commit
62033d0a42
@ -613,7 +613,7 @@
|
|||||||
- [ ] create_cache_policy
|
- [ ] create_cache_policy
|
||||||
- [ ] create_cloud_front_origin_access_identity
|
- [ ] create_cloud_front_origin_access_identity
|
||||||
- [X] create_distribution
|
- [X] create_distribution
|
||||||
- [ ] create_distribution_with_tags
|
- [X] create_distribution_with_tags
|
||||||
- [ ] create_field_level_encryption_config
|
- [ ] create_field_level_encryption_config
|
||||||
- [ ] create_field_level_encryption_profile
|
- [ ] create_field_level_encryption_profile
|
||||||
- [ ] create_function
|
- [ ] create_function
|
||||||
@ -6465,4 +6465,4 @@
|
|||||||
- workspaces
|
- workspaces
|
||||||
- workspaces-web
|
- workspaces-web
|
||||||
- xray
|
- xray
|
||||||
</details>
|
</details>
|
||||||
|
@ -41,6 +41,8 @@ class CloudFrontResponse(BaseResponse):
|
|||||||
if "DistributionConfigWithTags" in params:
|
if "DistributionConfigWithTags" in params:
|
||||||
config = params.get("DistributionConfigWithTags")
|
config = params.get("DistributionConfigWithTags")
|
||||||
tags = (config.get("Tags", {}).get("Items") or {}).get("Tag", [])
|
tags = (config.get("Tags", {}).get("Items") or {}).get("Tag", [])
|
||||||
|
if not isinstance(tags, list):
|
||||||
|
tags = [tags]
|
||||||
else:
|
else:
|
||||||
config = params
|
config = params
|
||||||
tags = []
|
tags = []
|
||||||
|
@ -19,3 +19,19 @@ def test_create_distribution_with_tags():
|
|||||||
resp["Tags"].should.have.key("Items").length_of(2)
|
resp["Tags"].should.have.key("Items").length_of(2)
|
||||||
resp["Tags"]["Items"].should.contain({"Key": "k1", "Value": "v1"})
|
resp["Tags"]["Items"].should.contain({"Key": "k1", "Value": "v1"})
|
||||||
resp["Tags"]["Items"].should.contain({"Key": "k2", "Value": "v2"})
|
resp["Tags"]["Items"].should.contain({"Key": "k2", "Value": "v2"})
|
||||||
|
|
||||||
|
|
||||||
|
@mock_cloudfront
|
||||||
|
def test_create_distribution_with_tags_only_one_tag():
|
||||||
|
client = boto3.client("cloudfront", region_name="us-west-1")
|
||||||
|
config = scaffold.example_distribution_config("ref")
|
||||||
|
tags = {"Items": [{"Key": "k1", "Value": "v1"}]}
|
||||||
|
config = {"DistributionConfig": config, "Tags": tags}
|
||||||
|
|
||||||
|
resp = client.create_distribution_with_tags(DistributionConfigWithTags=config)
|
||||||
|
resp.should.have.key("Distribution")
|
||||||
|
|
||||||
|
resp = client.list_tags_for_resource(Resource=resp["Distribution"]["ARN"])
|
||||||
|
resp.should.have.key("Tags")
|
||||||
|
resp["Tags"].should.have.key("Items").length_of(1)
|
||||||
|
resp["Tags"]["Items"].should.contain({"Key": "k1", "Value": "v1"})
|
||||||
|
Loading…
Reference in New Issue
Block a user