From 776bbb32433462ccafe84b8e3f2c1d475068d576 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 27 Jan 2022 15:59:50 +0000 Subject: [PATCH] Respect wait parameter in elb_instance when adding/removing instances (#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 --- changelogs/fragments/825-fix-elb-wait.yml | 2 ++ plugins/modules/elb_instance.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/825-fix-elb-wait.yml diff --git a/changelogs/fragments/825-fix-elb-wait.yml b/changelogs/fragments/825-fix-elb-wait.yml new file mode 100644 index 00000000000..afc87a06c56 --- /dev/null +++ b/changelogs/fragments/825-fix-elb-wait.yml @@ -0,0 +1,2 @@ +minor_changes: + - elb_instance - `wait` parameter is no longer ignored (https://github.com/ansible-collections/community.aws/pull/826) diff --git a/plugins/modules/elb_instance.py b/plugins/modules/elb_instance.py index 6116207866b..51ec03d5702 100644 --- a/plugins/modules/elb_instance.py +++ b/plugins/modules/elb_instance.py @@ -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 @@ -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):