From 99c64a6e9993aed6a825798079a2b964904beb72 Mon Sep 17 00:00:00 2001 From: Hugh Saunders Date: Wed, 26 Jan 2022 11:39:09 +0000 Subject: [PATCH] Respect wait parameter in elb_instance when adding/removing instances (#826) Respect wait parameter in elb_instance when adding/removing instances 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 Reviewed-by: Alina Buzachis Reviewed-by: Markus Bergholz --- 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):