Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elbv2 - Drop tests for ancient botocore (not supported) #1477

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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