-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NotFound retries when tagging a new VPC Peering connection #614
Merged
ansible-zuul
merged 2 commits into
ansible-collections:main
from
tremble:stability/ec2_vpc_peer
Jun 29, 2021
Merged
Add NotFound retries when tagging a new VPC Peering connection #614
ansible-zuul
merged 2 commits into
ansible-collections:main
from
tremble:stability/ec2_vpc_peer
Jun 29, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add NotFound retries when tagging a new VPC Peering connection
tremble
force-pushed
the
stability/ec2_vpc_peer
branch
from
June 29, 2021 09:36
cbc498f
to
8930cce
Compare
ansibullbot
added
bug
This issue/PR relates to a bug
community_review
module
module
needs_triage
owner_pr
PR created by owner/maintainer
plugins
plugin (any type)
python3
traceback
labels
Jun 29, 2021
alinabuzachis
approved these changes
Jun 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @tremble.
alinabuzachis
pushed a commit
to alinabuzachis/community.aws
that referenced
this pull request
Jul 16, 2021
…bility/ec2_vpc_peer Add NotFound retries when tagging a new VPC Peering connection SUMMARY Prior to botocore 1.17.24 it wasn't possible to tag the connection as a part of the creation call. As such a separate create_tags call is performed after the creation. However, this leads to a race condition when "I(wait=False)". Rather than adding hard to test logic, add InvalidVpcPeeringConnectionID.NotFound retries to the tagging. Also move from custom tag handling code over to the shared code in ansible_collections.amazon.aws.plugins.module_utils.ec2 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_vpc_peer ADDITIONAL INFORMATION TASK [ec2_vpc_peer : Create local account VPC peering Connection] ************** task path: /home/zuul/.ansible/collections/ansible_collections/community/aws/tests/integration/targets/ec2_vpc_peer/tasks/main.yml:403 <testhost> ESTABLISH LOCAL CONNECTION FOR USER: zuul <testhost> EXEC /bin/sh -c 'echo ~zuul && sleep 0' <testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zuul/.ansible/tmp `"&& mkdir "` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" && echo ansible-tmp-1624925621.1931164-8629-186765425497910="` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" ) && sleep 0' Using module file /home/zuul/.ansible/collections/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py <testhost> PUT /home/zuul/.ansible/tmp/ansible-local-8151h1f3kbcc/tmplyozom8u TO /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py <testhost> EXEC /bin/sh -c 'chmod u+x /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /home/zuul/venv/bin/python3.6 /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'rm -f -r /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py", line 559, in create_tags File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py", line 288, in deciding_wrapper return retrying_wrapper(*args, **kwargs) File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 154, in retry_func raise e File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 144, in retry_func return f(*args, **kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name) fatal: [testhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "aws_access_key": "ASIA6CCDWXDOPPPI445H", "aws_ca_bundle": null, "aws_config": null, "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "debug_botocore_endpoint_logs": true, "ec2_url": null, "peer_owner_id": null, "peer_region": null, "peer_vpc_id": "vpc-0deec00ddeb3584bf", "peering_id": null, "profile": null, "region": "us-east-1", "security_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "state": "present", "tags": { "Name": "Peering connection for VPC vpc-018bc7cc64b0731f9 to VPC vpc-0deec00ddeb3584bf" }, "validate_certs": true, "vpc_id": "vpc-018bc7cc64b0731f9", "wait": false } }, "msg": "An error occurred (InvalidVpcPeeringConnectionID.NotFound) when calling the CreateTags operation: The vpcPeeringConnection ID 'pcx-06ed26ea8993aba5b' does not exist", "resource_actions": [ "ec2:DeleteTags", "ec2:CreateTags", "ec2:CreateVpcPeeringConnection", "ec2:DescribeVpcPeeringConnections" ] } Reviewed-by: Alina Buzachis <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections@9024067
alinabuzachis
pushed a commit
to alinabuzachis/community.aws
that referenced
this pull request
Jul 19, 2021
…_vpc_peer Add NotFound retries when tagging a new VPC Peering connection SUMMARY Prior to botocore 1.17.24 it wasn't possible to tag the connection as a part of the creation call. As such a separate create_tags call is performed after the creation. However, this leads to a race condition when "I(wait=False)". Rather than adding hard to test logic, add InvalidVpcPeeringConnectionID.NotFound retries to the tagging. Also move from custom tag handling code over to the shared code in ansible_collections.amazon.aws.plugins.module_utils.ec2 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_vpc_peer ADDITIONAL INFORMATION TASK [ec2_vpc_peer : Create local account VPC peering Connection] ************** task path: /home/zuul/.ansible/collections/ansible_collections/community/aws/tests/integration/targets/ec2_vpc_peer/tasks/main.yml:403 <testhost> ESTABLISH LOCAL CONNECTION FOR USER: zuul <testhost> EXEC /bin/sh -c 'echo ~zuul && sleep 0' <testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zuul/.ansible/tmp `"&& mkdir "` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" && echo ansible-tmp-1624925621.1931164-8629-186765425497910="` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" ) && sleep 0' Using module file /home/zuul/.ansible/collections/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py <testhost> PUT /home/zuul/.ansible/tmp/ansible-local-8151h1f3kbcc/tmplyozom8u TO /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py <testhost> EXEC /bin/sh -c 'chmod u+x /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /home/zuul/venv/bin/python3.6 /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'rm -f -r /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py", line 559, in create_tags File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py", line 288, in deciding_wrapper return retrying_wrapper(*args, **kwargs) File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 154, in retry_func raise e File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 144, in retry_func return f(*args, **kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name) fatal: [testhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "aws_access_key": "ASIA6CCDWXDOPPPI445H", "aws_ca_bundle": null, "aws_config": null, "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "debug_botocore_endpoint_logs": true, "ec2_url": null, "peer_owner_id": null, "peer_region": null, "peer_vpc_id": "vpc-0deec00ddeb3584bf", "peering_id": null, "profile": null, "region": "us-east-1", "security_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "state": "present", "tags": { "Name": "Peering connection for VPC vpc-018bc7cc64b0731f9 to VPC vpc-0deec00ddeb3584bf" }, "validate_certs": true, "vpc_id": "vpc-018bc7cc64b0731f9", "wait": false } }, "msg": "An error occurred (InvalidVpcPeeringConnectionID.NotFound) when calling the CreateTags operation: The vpcPeeringConnection ID 'pcx-06ed26ea8993aba5b' does not exist", "resource_actions": [ "ec2:DeleteTags", "ec2:CreateTags", "ec2:CreateVpcPeeringConnection", "ec2:DescribeVpcPeeringConnections" ] } Reviewed-by: Alina Buzachis <None>
alinabuzachis
pushed a commit
to alinabuzachis/community.aws
that referenced
this pull request
Jul 19, 2021
…_vpc_peer Add NotFound retries when tagging a new VPC Peering connection SUMMARY Prior to botocore 1.17.24 it wasn't possible to tag the connection as a part of the creation call. As such a separate create_tags call is performed after the creation. However, this leads to a race condition when "I(wait=False)". Rather than adding hard to test logic, add InvalidVpcPeeringConnectionID.NotFound retries to the tagging. Also move from custom tag handling code over to the shared code in ansible_collections.amazon.aws.plugins.module_utils.ec2 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_vpc_peer ADDITIONAL INFORMATION TASK [ec2_vpc_peer : Create local account VPC peering Connection] ************** task path: /home/zuul/.ansible/collections/ansible_collections/community/aws/tests/integration/targets/ec2_vpc_peer/tasks/main.yml:403 <testhost> ESTABLISH LOCAL CONNECTION FOR USER: zuul <testhost> EXEC /bin/sh -c 'echo ~zuul && sleep 0' <testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zuul/.ansible/tmp `"&& mkdir "` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" && echo ansible-tmp-1624925621.1931164-8629-186765425497910="` echo /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910 `" ) && sleep 0' Using module file /home/zuul/.ansible/collections/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py <testhost> PUT /home/zuul/.ansible/tmp/ansible-local-8151h1f3kbcc/tmplyozom8u TO /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py <testhost> EXEC /bin/sh -c 'chmod u+x /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'ANSIBLE_DEBUG_BOTOCORE_LOGS=True /home/zuul/venv/bin/python3.6 /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/AnsiballZ_ec2_vpc_peer.py && sleep 0' <testhost> EXEC /bin/sh -c 'rm -f -r /home/zuul/.ansible/tmp/ansible-tmp-1624925621.1931164-8629-186765425497910/ > /dev/null 2>&1 && sleep 0' The full traceback is: File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_vpc_peer.py", line 559, in create_tags File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py", line 288, in deciding_wrapper return retrying_wrapper(*args, **kwargs) File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 154, in retry_func raise e File "/tmp/ansible_ec2_vpc_peer_payload_bbdh2ojz/ansible_ec2_vpc_peer_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 144, in retry_func return f(*args, **kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 386, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/zuul/venv/lib/python3.6/site-packages/botocore/client.py", line 705, in _make_api_call raise error_class(parsed_response, operation_name) fatal: [testhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "aws_access_key": "ASIA6CCDWXDOPPPI445H", "aws_ca_bundle": null, "aws_config": null, "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "debug_botocore_endpoint_logs": true, "ec2_url": null, "peer_owner_id": null, "peer_region": null, "peer_vpc_id": "vpc-0deec00ddeb3584bf", "peering_id": null, "profile": null, "region": "us-east-1", "security_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "state": "present", "tags": { "Name": "Peering connection for VPC vpc-018bc7cc64b0731f9 to VPC vpc-0deec00ddeb3584bf" }, "validate_certs": true, "vpc_id": "vpc-018bc7cc64b0731f9", "wait": false } }, "msg": "An error occurred (InvalidVpcPeeringConnectionID.NotFound) when calling the CreateTags operation: The vpcPeeringConnection ID 'pcx-06ed26ea8993aba5b' does not exist", "resource_actions": [ "ec2:DeleteTags", "ec2:CreateTags", "ec2:CreateVpcPeeringConnection", "ec2:DescribeVpcPeeringConnections" ] } Reviewed-by: Alina Buzachis <None>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
This issue/PR relates to a bug
community_review
module
module
needs_triage
owner_pr
PR created by owner/maintainer
plugins
plugin (any type)
python3
traceback
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Prior to botocore 1.17.24 it wasn't possible to tag the connection as a part of the creation call. As such a separate create_tags call is performed after the creation. However, this leads to a race condition when "I(wait=False)".
Rather than adding hard to test logic, add InvalidVpcPeeringConnectionID.NotFound retries to the tagging.
Also move from custom tag handling code over to the shared code in ansible_collections.amazon.aws.plugins.module_utils.ec2
ISSUE TYPE
COMPONENT NAME
ec2_vpc_peer
ADDITIONAL INFORMATION