diff --git a/changelogs/fragments/1477-elbv2-botocore.yml b/changelogs/fragments/1477-elbv2-botocore.yml new file mode 100644 index 00000000000..54736b033a3 --- /dev/null +++ b/changelogs/fragments/1477-elbv2-botocore.yml @@ -0,0 +1,2 @@ +minor_changes: +- module_utils/elbv2 - removed compatibility code for ``botocore < 1.10.30`` (https://github.com/ansible-collections/amazon.aws/pull/1477). diff --git a/plugins/module_utils/elbv2.py b/plugins/module_utils/elbv2.py index 25c7b0fd182..8bb0367ca89 100644 --- a/plugins/module_utils/elbv2.py +++ b/plugins/module_utils/elbv2.py @@ -897,17 +897,6 @@ def _compare_listener(self, current_listener, new_listener): # Default action - # Check proper rule format on current listener - if len(current_listener["DefaultActions"]) > 1: - for action in current_listener["DefaultActions"]: - if "Order" not in action: - self.module.fail_json( - msg="'Order' key not found in actions. " - "installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - # If the lengths of the actions are the same, we'll have to verify that the # contents of those actions are the same if len(current_listener["DefaultActions"]) == len(new_listener["DefaultActions"]): @@ -952,14 +941,7 @@ def add(self): self.listener.pop("Rules") AWSRetry.jittered_backoff()(self.connection.create_listener)(LoadBalancerArn=self.elb_arn, **self.listener) except (BotoCoreError, ClientError) as e: - if '"Order", must be one of: Type, TargetGroupArn' in str(e): - self.module.fail_json( - msg="installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - else: - self.module.fail_json_aws(e) + self.module.fail_json_aws(e) def modify(self): try: @@ -968,14 +950,7 @@ def modify(self): self.listener.pop("Rules") AWSRetry.jittered_backoff()(self.connection.modify_listener)(**self.listener) except (BotoCoreError, ClientError) as e: - if '"Order", must be one of: Type, TargetGroupArn' in str(e): - self.module.fail_json( - msg="installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - else: - self.module.fail_json_aws(e) + self.module.fail_json_aws(e) def delete(self): try: @@ -1120,17 +1095,6 @@ def _compare_rule(self, current_rule, new_rule): # Actions - # Check proper rule format on current listener - if len(current_rule["Actions"]) > 1: - for action in current_rule["Actions"]: - if "Order" not in action: - self.module.fail_json( - msg="'Order' key not found in actions. " - "installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - # If the lengths of the actions are the same, we'll have to verify that the # contents of those actions are the same if len(current_rule["Actions"]) == len(new_rule["Actions"]): @@ -1214,14 +1178,7 @@ def create(self): self.rule["Priority"] = int(self.rule["Priority"]) AWSRetry.jittered_backoff()(self.connection.create_rule)(**self.rule) except (BotoCoreError, ClientError) as e: - if '"Order", must be one of: Type, TargetGroupArn' in str(e): - self.module.fail_json( - msg="installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - else: - self.module.fail_json_aws(e) + self.module.fail_json_aws(e) self.changed = True @@ -1236,14 +1193,7 @@ def modify(self): del self.rule["Priority"] AWSRetry.jittered_backoff()(self.connection.modify_rule)(**self.rule) except (BotoCoreError, ClientError) as e: - if '"Order", must be one of: Type, TargetGroupArn' in str(e): - self.module.fail_json( - msg="installed version of botocore does not support " - "multiple actions, please upgrade botocore to version " - "1.10.30 or higher" - ) - else: - self.module.fail_json_aws(e) + self.module.fail_json_aws(e) self.changed = True