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

aws_ec2 inventory - migration to Python 3.6 f-strings #1526

Merged
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
5 changes: 5 additions & 0 deletions changelogs/fragments/fstring-ec2_inv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 1483 includes a fragment and links to 1513
trivial:
- bulk migration of ``%`` and ``.format()`` to fstrings (https://github.com/ansible-collections/amazon.aws/pull/1526).
minor_changes:
- ec2_vpc_subnet - retry fetching subnet details after creation if the first attempt fails (https://github.com/ansible-collections/amazon.aws/pull/1526).
2 changes: 1 addition & 1 deletion plugins/inventory/aws_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _prepare_host_vars(

if use_contrib_script_compatible_ec2_tag_keys:
for k, v in host_vars["tags"].items():
host_vars["ec2_tag_%s" % k] = v
host_vars[f"ec2_tag_{k}"] = v

if hostvars_prefix or hostvars_suffix:
for hostvar, hostval in host_vars.copy().items():
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/ec2_vpc_subnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ def ensure_subnet_present(conn, module):

subnet = get_matching_subnet(conn, module, module.params["vpc_id"], module.params["cidr"])
if not module.check_mode and module.params["wait"]:
for _rewait in range(0, 5):
if subnet:
break
time.sleep(2)
subnet = get_matching_subnet(conn, module, module.params["vpc_id"], module.params["cidr"])
# GET calls are not monotonic for map_public_ip_on_launch and assign_ipv6_address_on_creation
# so we only wait for those if necessary just before returning the subnet
subnet = ensure_final_subnet(conn, module, subnet, start_time)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
owner-id: '125523088429'
virtualization-type: hvm
root-device-type: ebs
name: 'Fedora-Cloud-Base-34-1.2.x86_64*'
name: 'Fedora-Cloud-Base-37-1.2.x86_64*'
register: fedora_images

- name: Set image id, vpc cidr and subnet cidr
Expand Down