Skip to content

Commit

Permalink
inventory/aws_ec2: drop := operator because we still support py3.6 (a…
Browse files Browse the repository at this point in the history
…nsible-collections#1098)

inventory/aws_ec2: drop := operator because we still support py3.6

Depends-On: ansible/ansible-zuul-jobs#1649
Depends-On: ansible-collections#1100
The operator was included with Python 3.8.
See: https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
goneri authored Oct 3, 2022
1 parent adbdb26 commit ea44066
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/inventory-aws_ec2-avoid-py38-syntax.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- "inventory/aws_ec2 - Avoid the := operator (py3.8+) because we still support Python 3.6."
4 changes: 2 additions & 2 deletions plugins/inventory/aws_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,9 @@ def iter_entry(self, hosts, hostnames, allow_duplicated_hosts=False, hostvars_pr
for host in hosts:
if allow_duplicated_hosts:
hostname_list = self.get_all_hostnames(host, hostnames)
elif preferred_hostname := self._get_preferred_hostname(host, hostnames):
hostname_list = [preferred_hostname]
else:
hostname_list = [self._get_preferred_hostname(host, hostnames)]
if not hostname_list or hostname_list[0] is None:
continue

host_vars = self.prepare_host_vars(
Expand Down

0 comments on commit ea44066

Please sign in to comment.