Skip to content
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

ec2_vpc_dhcp_option - retry describe_dhcp_options on InvalidDhcpOptioID.NotFound #1320

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/1320-ec2_vpc_dhcp_options-retrys.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- ec2_vpc_dhcp_option - retry ``describe_dhcp_options`` after creation when ``InvalidDhcpOptionID.NotFound`` is raised
(https://github.com/ansible-collections/amazon.aws/pull/1320).
8 changes: 7 additions & 1 deletion plugins/modules/ec2_vpc_dhcp_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,13 @@ def get_dhcp_options_info(client, module, dhcp_options_id):
return None

try:
dhcp_option_info = client.describe_dhcp_options(aws_retry=True, DhcpOptionsIds=[dhcp_options_id])
dhcp_option_info = AWSRetry.jittered_backoff(
catch_extra_error_codes=["InvalidDhcpOptionID.NotFound"]
)(
client.describe_dhcp_options,
)(
DhcpOptionsIds=[dhcp_options_id],
)
except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
module.fail_json_aws(e, msg="Unable to describe dhcp options")

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/targets/ec2_vpc_net/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@
- name: create a DHCP option set to use in next test
ec2_vpc_dhcp_option:
dns_servers:
- 4.4.4.4
- 8.8.4.4
- 8.8.8.8
tags:
Name: "{{ vpc_name }}"
register: new_dhcp
- name: assert the DHCP option set was successfully created
assert:
that:
- new_dhcp is changed
- new_dhcp is successful

- name: modify the DHCP options set for a VPC (check_mode)
ec2_vpc_net:
Expand Down