Skip to content

Commit

Permalink
Respect wait parameter in elb_instance when adding/removing instances (
Browse files Browse the repository at this point in the history
…#826) (#886)

[PR #826/99c64a6e backport][stable-2] Respect wait parameter in elb_instance when adding/removing instances

This is a backport of PR #826 as merged into main (99c64a6).
SUMMARY
The wait parameter is currently ignored when registering or
deregistering an instance with an ELB. Looks like this was lost in the
boto3 migration: 96f1518
Related: #825
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
elb_instance
ADDITIONAL INFORMATION
See #825
  • Loading branch information
patchback[bot] authored Jan 27, 2022
1 parent beaca66 commit 776bbb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/825-fix-elb-wait.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- elb_instance - `wait` parameter is no longer ignored (https://github.com/ansible-collections/community.aws/pull/826)
10 changes: 6 additions & 4 deletions plugins/modules/elb_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ def deregister(self, wait, timeout):
# already OutOfService is being deregistered.
self.changed = True

for lb in self.lbs:
self._await_elb_instance_state(lb, 'Deregistered', timeout)
if wait:
for lb in self.lbs:
self._await_elb_instance_state(lb, 'Deregistered', timeout)

def register(self, wait, enable_availability_zone, timeout):
"""Register the instance for all ELBs and wait for the ELB
Expand Down Expand Up @@ -176,8 +177,9 @@ def register(self, wait, enable_availability_zone, timeout):

self.changed = True

for lb in self.lbs:
self._await_elb_instance_state(lb, 'InService', timeout)
if wait:
for lb in self.lbs:
self._await_elb_instance_state(lb, 'InService', timeout)

@AWSRetry.jittered_backoff()
def _describe_elbs(self, **params):
Expand Down

0 comments on commit 776bbb3

Please sign in to comment.