Skip to content

Commit

Permalink
Drop tests for ancient botocore (not supported)
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Apr 26, 2023
1 parent 79255df commit c0db278
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 54 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1477-elbv2-botocore.yml
Original file line number Diff line number Diff line change
@@ -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).
58 changes: 4 additions & 54 deletions plugins/module_utils/elbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]):
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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"]):
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit c0db278

Please sign in to comment.