Skip to content

Commit

Permalink
[7.0.0] Bump botocore requirements (#1968)
Browse files Browse the repository at this point in the history
[7.0.0] Bump botocore requirements

SUMMARY
In line with ansible-collections/amazon.aws#1763 bump our botocore requirements for 7.0.0
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
README.md
changelogs/fragments/botocore.yml
changelogs/fragments/python37.yml
plugins/modules/dynamodb_table.py
plugins/modules/ec2_launch_template.py
plugins/modules/networkfirewall_policy.py
plugins/modules/networkfirewall_rule_group.py
plugins/modules/networkfirewall_rule_group_info.py
plugins/modules/opensearch.py
plugins/modules/opensearch_info.py
plugins/modules/s3_lifecycle.py
plugins/modules/wafv2_web_acl.py
requirements.txt
tests/config.yml
tests/integration/constraints.txt
tests/unit/constraints.txt
ADDITIONAL INFORMATION
Deliberately links to the amazon.aws PR to avoid duplicating the reasons.

Reviewed-by: Alina Buzachis
  • Loading branch information
tremble authored Oct 16, 2023
1 parent 91da9ef commit b753fe5
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 71 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,33 @@ Use community.aws 4.x.y if you are using Ansible 2.9 or Ansible Core 2.10.

This collection depends on the AWS SDK for Python (Boto3 and Botocore). Due to the
[AWS SDK Python Support Policy](https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/)
this collection requires Python 3.6 or greater.

Amazon have also announced the end of support for
[Python less than 3.7](https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/).
As such support for Python less than 3.7 by this collection has been deprecated and will be removed in release 7.0.0.
Additionally, support for Python less than 3.8 is expected to be removed in a release after 2024-12-01 based on currently
available schedules.
this collection requires Python 3.7 or greater.

Amazon have also announced the planned end of support for
[Python less than 3.8](https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/).
As such support for Python less than 3.8 will be removed in a release after 2024-12-01.

<!---
### End of Support by Python Versions:
| Python Version | AWS SDK | Collection |
| -------------- | -------- | ---------- |
| 2.7 | July 2021 | Release 2.0.0 (September 2021) |
| 3.4 | February 2021 | Release 1.0.0 (June 2020) |
| 3.5 | February 2021 | Release 2.0.0 (September 2021) |
| 3.6 | May 2022 | Release 7.0.0 (November 2023) |
| 3.7 | December 2023 | *After December 2024* |
| 3.8 | April 2025 | *After April 2026* |
| 3.9 | April 2026 | *After April 2027* |
| 3.10 | April 2027 | *After April 2028* |
| 3.11 | April 2028 | *After April 2029* |
--->

## AWS SDK version compatibility

Starting with the 2.0.0 releases of amazon.aws and community.aws, it is generally the collection's policy to support the versions of `botocore` and `boto3` that were released 12 months prior to the most recent major collection release, following semantic versioning (for example, 2.0.0, 3.0.0).

Version 6.0.0 of this collection supports `boto3 >= 1.22.0` and `botocore >= 1.25.0`
Version 7.0.0 of this collection supports `boto3 >= 1.26.0` and `botocore >= 1.29.0`

All support for the original AWS SDK `boto` was removed in release 4.0.0.

Expand Down
6 changes: 6 additions & 0 deletions changelogs/fragments/botocore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
breaking_changes:
- The community.aws collection has dropped support for ``botocore<1.29.0`` and
``boto3<1.26.0``. Most modules will continue to work with older versions of the AWS SDK, however
compatability with older versions of the SDK is not guaranteed and will not be tested. When using
older versions of the SDK a warning will be emitted by Ansible
(https://github.com/ansible-collections/amazon.aws/pull/1763).
10 changes: 10 additions & 0 deletions changelogs/fragments/python37.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
breaking_changes:
- community.aws collection - due to the AWS SDKs announcing the end of support
for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/)
support for Python less than 3.7 by this collection wss been deprecated in release 6.0.0 and removed in release 7.0.0.
(https://github.com/ansible-collections/amazon.aws/pull/1763).

# We've already announced the deprecation for <3.8 (with 6.0.0), dropping support for <3.9 on ours side will happen
# after April 2026. This is about 2 years + 5 months away assuming a November 7.0.0 release, we could announce
# the deprecation now, but assuming we release 8.0.0 in about 6 months a just short of 2 year
# deprecation feels fine given it's predictable.
4 changes: 3 additions & 1 deletion plugins/module_utils/networkfirewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ def _filter_immutable_metadata_attributes(self, metadata):
Removes information from the metadata which can't be updated.
Returns a *copy* of the metadata dictionary.
"""
return deepcopy(metadata)
meta = deepcopy(metadata)
meta.pop("LastModifiedTime", None)
return meta

def _flush_create(self):
changed = super(BaseNetworkFirewallManager, self)._flush_create()
Expand Down
4 changes: 0 additions & 4 deletions plugins/modules/dynamodb_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
table_class:
description:
- The class of the table.
- Requires at least botocore version 1.23.18.
choices: ['STANDARD', 'STANDARD_INFREQUENT_ACCESS']
type: str
version_added: 3.1.0
Expand Down Expand Up @@ -1056,9 +1055,6 @@ def main():
)
client = module.client("dynamodb", retry_decorator=retry_decorator)

if module.params.get("table_class"):
module.require_botocore_at_least("1.23.18", reason="to set table_class")

current_table = get_dynamodb_table()
changed = False
table = None
Expand Down
19 changes: 0 additions & 19 deletions plugins/modules/ec2_launch_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,13 @@
type: str
description: >
- Wether the instance metadata endpoint is available via IPv6 (C(enabled)) or not (C(disabled)).
- Requires botocore >= 1.21.29
choices: [enabled, disabled]
default: 'disabled'
instance_metadata_tags:
version_added: 3.1.0
type: str
description:
- Wether the instance tags are availble (C(enabled)) via metadata endpoint or not (C(disabled)).
- Requires botocore >= 1.23.30
choices: [enabled, disabled]
default: 'disabled'
extends_documentation_fragment:
Expand Down Expand Up @@ -582,23 +580,6 @@ def create_or_update(module, template_options):
lt_data = params_to_launch_data(module, dict((k, v) for k, v in module.params.items() if k in template_options))
lt_data = scrub_none_parameters(lt_data, descend_into_lists=True)

if lt_data.get("MetadataOptions"):
if not module.botocore_at_least("1.23.30"):
# fail only if enabled is requested
if lt_data["MetadataOptions"].get("InstanceMetadataTags") == "enabled":
module.require_botocore_at_least("1.23.30", reason="to set instance_metadata_tags")
# pop if it's not requested to keep backwards compatibility.
# otherwise the modules failes because parameters are set due default values
lt_data["MetadataOptions"].pop("InstanceMetadataTags")

if not module.botocore_at_least("1.21.29"):
# fail only if enabled is requested
if lt_data["MetadataOptions"].get("HttpProtocolIpv6") == "enabled":
module.require_botocore_at_least("1.21.29", reason="to set http_protocol_ipv6")
# pop if it's not requested to keep backwards compatibility.
# otherwise the modules failes because parameters are set due default values
lt_data["MetadataOptions"].pop("HttpProtocolIpv6")

if not (template or template_versions):
# create a full new one
try:
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/networkfirewall_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
C(aws:alert_strict) and C(aws:alert_established).
- Only valid for policies where I(strict_rule_order=true).
- When creating a new policy defaults to C(aws:drop_strict).
- I(stateful_default_actions) requires botocore>=1.21.52.
required: false
type: list
elements: str
Expand All @@ -86,7 +85,6 @@
- When I(strict_rule_order='strict') rules and rule groups are evaluated in
the order that they're defined.
- Cannot be updated after creation.
- I(stateful_rule_order) requires botocore>=1.21.52.
required: false
type: str
choices: ['default', 'strict']
Expand Down Expand Up @@ -398,10 +396,6 @@ def main():
manager.set_wait_timeout(module.params.get("wait_timeout", None))

rule_order = module.params.get("stateful_rule_order")
if rule_order and rule_order != "default":
module.require_botocore_at_least("1.21.52", reason="to set the rule order")
if module.params.get("stateful_default_actions"):
module.require_botocore_at_least("1.21.52", reason="to set the default actions for stateful flows")

if state == "absent":
manager.delete()
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/networkfirewall_rule_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
- Mutually exclusive with I(rule_type=stateless).
- For more information on how rules are evaluated read the AWS documentation
U(https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html).
- I(rule_order) requires botocore>=1.23.23.
type: str
required: false
choices: ['default', 'strict']
Expand Down Expand Up @@ -772,8 +771,6 @@ def main():
],
)

module.require_botocore_at_least("1.19.20")

state = module.params.get("state")
name = module.params.get("name")
arn = module.params.get("arn")
Expand All @@ -789,9 +786,6 @@ def main():
if module.params.get("domain_list"):
module.fail_json("domain_list can only be used for stateful rule groups")

if module.params.get("rule_order"):
module.require_botocore_at_least("1.23.23", reason="to set the rule order")

manager = NetworkFirewallRuleManager(module, arn=arn, name=name, rule_type=rule_type)
manager.set_wait(module.params.get("wait", None))
manager.set_wait_timeout(module.params.get("wait_timeout", None))
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/networkfirewall_rule_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
- When I(scope='account') returns a description of all rule groups in the account.
- When I(scope='managed') returns a list of available managed rule group arns.
- By default searches only at the account scope.
- I(scope='managed') requires botocore>=1.23.23.
required: false
choices: ['managed', 'account']
type: str
Expand Down Expand Up @@ -412,16 +411,11 @@ def main():
],
)

module.require_botocore_at_least("1.19.20")

arn = module.params.get("arn")
name = module.params.get("name")
rule_type = module.params.get("rule_type")
scope = module.params.get("scope")

if module.params.get("scope") == "managed":
module.require_botocore_at_least("1.23.23", reason="to list managed rules")

manager = NetworkFirewallRuleManager(module, name=name, rule_type=rule_type)

results = dict(changed=False)
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,6 @@ def main():
supports_check_mode=True,
)

module.require_botocore_at_least("1.21.38")

try:
client = module.client("opensearch", retry_decorator=AWSRetry.jittered_backoff())
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/opensearch_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ def main():
),
supports_check_mode=True,
)
module.require_botocore_at_least("1.21.38")

try:
client = module.client("opensearch", retry_decorator=AWSRetry.jittered_backoff())
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/s3_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
noncurrent_version_keep_newer:
description:
- The minimum number of non-current versions to retain.
- Requires C(botocore >= 1.23.12)
- Requres I(noncurrent_version_expiration_days).
required: false
type: int
Expand Down Expand Up @@ -638,11 +637,6 @@ def main():
transition_date = module.params.get("transition_date")
state = module.params.get("state")

if module.params.get("noncurrent_version_keep_newer"):
module.require_botocore_at_least(
"1.23.12", reason="to set number of versions to keep with noncurrent_version_keep_newer"
)

if state == "present" and module.params["status"] == "enabled": # allow deleting/disabling a rule by id/prefix
required_when_present = (
"abort_incomplete_multipart_upload_days",
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/wafv2_web_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
- A map of custom response keys and content bodies. Define response bodies here and reference them in the rules by providing
- the key of the body dictionary element.
- Each element must have a unique dict key and in the dict two keys for I(content_type) and I(content).
- Requires botocore >= 1.20.40
type: dict
version_added: 3.1.0
purge_rules:
Expand Down Expand Up @@ -503,7 +502,6 @@ def main():

custom_response_bodies = module.params.get("custom_response_bodies")
if custom_response_bodies:
module.require_botocore_at_least("1.20.40", reason="to set custom response bodies")
custom_response_bodies = {}

for custom_name, body in module.params.get("custom_response_bodies").items():
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# - tests/unit/constraints.txt
# - tests/integration/constraints.txt
# - tests/integration/targets/setup_botocore_pip
botocore>=1.25.0
boto3>=1.22.0
botocore>=1.29.0
boto3>=1.26.0
2 changes: 1 addition & 1 deletion tests/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
modules:
python_requires: '>=3.6'
python_requires: '>=3.7'
8 changes: 4 additions & 4 deletions tests/integration/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Specifically run tests against the oldest versions that we support
boto3==1.22.0
botocore==1.25.0
botocore==1.29.0
boto3==1.26.0

# AWS CLI has `botocore==` dependencies, provide the one that matches botocore
# to avoid needing to download over a years worth of awscli wheels.
awscli==1.23.0
awscli==1.27.0

# AWS CLI depends on PyYAML <5.5,>=3.10; the latest PyYAML release in that range, 5.4.1, fails to install.
# Use a version in that range that is known to work (https://github.com/yaml/pyyaml/issues/736)
PyYAML==5.3.1
PyYAML==5.3.1
6 changes: 3 additions & 3 deletions tests/unit/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specifically run tests against the oldest versions that we support
boto3==1.22.0
botocore==1.25.0
botocore==1.29.0
boto3==1.26.0

# AWS CLI has `botocore==` dependencies, provide the one that matches botocore
# to avoid needing to download over a years worth of awscli wheels.
awscli==1.23.0
awscli==1.27.0

0 comments on commit b753fe5

Please sign in to comment.