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

Bump botocore requirement to 1.34.0 #2426

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Tested with the Ansible Core >= 2.15.0 versions, and the current development ver

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.7 or greater.
this collection requires Python 3.8 or greater.

Amazon has 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.
[Python less than 3.9](https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/).
As such support for Python less than 3.9 will be removed in a release after 2026-05-01.

<!---
### End of Support by Python Versions:
Expand All @@ -58,7 +58,7 @@ As such support for Python less than 3.8 will be removed in a release after 2024

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 9.0.0 of this collection supports `boto3 >= 1.28.0` and `botocore >= 1.31.0`
Version 10.0.0 of this collection supports `boto3 >= 1.34.0` and `botocore >= 1.34.0`

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

Expand Down
11 changes: 11 additions & 0 deletions changelogs/fragments/botocore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
major_changes:
- amazon.aws collection - The amazon.aws collection has dropped support for
``botocore<1.34.0`` and ``boto3<1.34.0``. Most modules will continue to work
with older versions of the AWS SDK, however compatibility 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/2426).
- amazon.aws collection - due to the AWS SDKs announcing the end of support for Python less than 3.8
(https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) support for Python
less than 3.8 by this collection was deprecated in release 6.0.0 and removed in release 10.0.0.
(https://github.com/ansible-collections/amazon.aws/pull/2426).
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ plugin_routing:
redirect: amazon.aws.ssm_parameter
aws_secret:
# Deprecation for this alias should not *start* prior to 2024-09-01
redirect: amazon.aws.secretsmanager_secret
redirect: amazon.aws.secretsmanager_secret
2 changes: 0 additions & 2 deletions mypy.ini

This file was deleted.

4 changes: 2 additions & 2 deletions plugins/module_utils/botocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
from .exceptions import AnsibleBotocoreError
from .retries import AWSRetry

MINIMUM_BOTOCORE_VERSION = "1.31.0"
MINIMUM_BOTO3_VERSION = "1.28.0"
MINIMUM_BOTOCORE_VERSION = "1.34.0"
MINIMUM_BOTO3_VERSION = "1.34.0"


def _get_user_agent_string():
Expand Down
12 changes: 1 addition & 11 deletions plugins/modules/backup_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
description:
- This is the timezone in which the schedule expression is set.
- By default, ScheduleExpressions are in UTC. You can modify this to a specified timezone.
- This option requires botocore >= 1.31.36.
type: str
default: "Etc/UTC"
required: false
Expand Down Expand Up @@ -327,9 +326,8 @@
schedule_expression_timezone:
description:
- This is the timezone in which the schedule expression is set.
- This information is returned for botocore versions >= 1.31.36.
type: str
returned: when botocore >= 1.31.36
returned: when configured
sample: "Etc/UTC"
version_added: 7.3.0
advanced_backup_settings:
Expand Down Expand Up @@ -667,14 +665,6 @@ def main():
],
}

if module.params["rules"]:
for each in plan["rules"]:
if not module.botocore_at_least("1.31.36"):
module.warn(
"schedule_expression_timezone requires botocore >= 1.31.36. schedule_expression_timezone will be ignored."
)
each.pop("schedule_expression_timezone")

tags = module.params["tags"]

# Get existing backup plan details and ID if present
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ transform-joins = true
exclude = [
"ec2_metadata_facts",
]

[tool.flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = true
ignore = ["E123", "E125", "E203", "E402", "E501", "E741", "F401", "F811", "F841", "W503"]
max-line-length = 160
builtins = "_"

[tool.mypy]
disable_error_code = ["import-untyped"]
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.31.0
boto3>=1.28.0
botocore>=1.34.0
boto3>=1.34.0
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
botocore
boto3

coverage==4.5.4
placebo
mock
pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
modules:
python_requires: ">=3.7"
python_requires: ">=3.8"
10 changes: 3 additions & 7 deletions tests/integration/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Specifically run tests against the oldest versions that we support
botocore==1.31.0
boto3==1.28.0
botocore==1.34.0
boto3==1.34.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.29.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
awscli==1.32.0
1 change: 1 addition & 0 deletions tests/integration/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ collections:
- ansible.windows
- ansible.utils # ipv6 filter
- amazon.cloud # used by integration tests - rds_cluster_modify
- community.crypto # SSL certificate generation
8 changes: 0 additions & 8 deletions tests/integration/targets/autoscaling_instance/tmp/inventory

This file was deleted.

34 changes: 0 additions & 34 deletions tests/integration/targets/autoscaling_instance/tmp/main.yml

This file was deleted.

12 changes: 0 additions & 12 deletions tests/integration/targets/autoscaling_instance/tmp/runme.sh

This file was deleted.

5 changes: 1 addition & 4 deletions tests/integration/targets/backup_plan/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
---
dependencies:
- role: setup_botocore_pip
vars:
botocore_version: "1.31.36"
dependencies: []
26 changes: 5 additions & 21 deletions tests/integration/targets/backup_plan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
- backup_plan_create_result.exists is true
- backup_plan_create_result.changed is true
- backup_plan_create_result.backup_plan_name == backup_plan_name
- backup_plan_create_result.backup_plan.rules != []
- "backup_plan_create_result.backup_plan.rules | selectattr('schedule_expression_timezone', 'match', 'Etc/UTC') | list"

- name: Get backup plan info
amazon.aws.backup_plan_info:
Expand All @@ -81,6 +83,8 @@
- backup_plan_idempotency_result.backup_plan_id == backup_plan_info.backup_plans[0].backup_plan_id
- backup_plan_idempotency_result.version_id == backup_plan_info.backup_plans[0].version_id
- backup_plan_idempotency_result.creation_date == backup_plan_info.backup_plans[0].creation_date
- backup_plan_idempotency_result.backup_plan.rules != []
- "backup_plan_idempotency_result.backup_plan.rules | selectattr('schedule_expression_timezone', 'match', 'Etc/UTC') | list"

- name: Update backup plan in check mode
amazon.aws.backup_plan:
Expand Down Expand Up @@ -305,7 +309,7 @@
- backup_plan_delete_result.backup_plan_arn == backup_plan_info.backup_plans[0].backup_plan_arn
- backup_plan_delete_result.deletion_date is defined

- name: Create a backup plan using specific botocore version
- name: Re-create backup plan
amazon.aws.backup_plan:
backup_plan_name: "{{ backup_plan_name }}"
rules:
Expand All @@ -314,8 +318,6 @@
tags:
Environment: Test
register: backup_plan_create_result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: Verify backup plan create result
ansible.builtin.assert:
Expand All @@ -326,24 +328,6 @@
- backup_plan_create_result.backup_plan.rules != []
- "backup_plan_create_result.backup_plan.rules | selectattr('schedule_expression_timezone', 'match', 'Etc/UTC') | list"

- name: Create a backup plan using specific botocore version (idempotency)
amazon.aws.backup_plan:
backup_plan_name: "{{ backup_plan_name }}"
rules:
- rule_name: daily
target_backup_vault_name: "{{ backup_vault_name }}"
tags:
Environment: Test
register: backup_plan_create_result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: Verify backup plan create result
ansible.builtin.assert:
that:
- backup_plan_create_result.exists is true
- backup_plan_create_result.changed is false

- name: Create another backup plan
amazon.aws.backup_plan:
backup_plan_name: "{{ backup_plan_name }}-1"
Expand Down
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
botocore==1.31.0
boto3==1.28.0
botocore==1.34.0
boto3==1.34.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.29.0
awscli==1.32.0
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class TestMinimalVersionTestSuite:
# Prepare some data for use in our testing
# ========================================================
def setup_method(self):
self.MINIMAL_BOTO3 = "1.28.0"
self.MINIMAL_BOTOCORE = "1.31.0"
self.OLD_BOTO3 = "1.27.999"
self.OLD_BOTOCORE = "1.30.999"
self.MINIMAL_BOTO3 = "1.34.0"
self.MINIMAL_BOTOCORE = "1.34.0"
self.OLD_BOTO3 = "1.33.999"
self.OLD_BOTOCORE = "1.33.999"

# ========================================================
# Test we don't warn when using valid versions
Expand Down
7 changes: 1 addition & 6 deletions tests/unit/module_utils/test_rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
# This file is part of Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

import sys
from contextlib import nullcontext
from unittest.mock import MagicMock
from unittest.mock import patch

import pytest

if sys.version_info < (3, 7):
pytest.skip("contextlib.nullcontext was introduced in Python 3.7", allow_module_level=True)

from contextlib import nullcontext

try:
import botocore
except ImportError:
Expand Down
13 changes: 0 additions & 13 deletions tests/unit/plugins/modules/ec2_security_group/test_expand_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# This file is part of Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

import sys
from unittest.mock import sentinel

import pytest
Expand Down Expand Up @@ -187,10 +186,6 @@ def test_expand_ports_list(rule, expected):
assert ec2_security_group_module.expand_ports_list(rule) == expected


@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="requires Python 3.7 or higher - sentinel doesn't behave well with deepcopy in Python 3.6",
)
@pytest.mark.parametrize("source_type", sorted(ec2_security_group_module.SOURCE_TYPES_ALL))
def test_strip_rule_source(source_type):
rule = {source_type: sentinel.SOURCE_VALUE}
Expand All @@ -202,10 +197,6 @@ def test_strip_rule_source(source_type):
assert rule == {source_type: sentinel.SOURCE_VALUE, "sentinel": sentinel.SENTINEL_VALUE}


@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="requires Python 3.7 or higher - sentinel doesn't behave well with deepcopy in Python 3.6",
)
@pytest.mark.parametrize("port_type", sorted(ec2_security_group_module.PORT_TYPES_ALL))
def test_strip_rule_port(port_type):
rule = {port_type: sentinel.PORT_VALUE}
Expand All @@ -217,10 +208,6 @@ def test_strip_rule_port(port_type):
assert rule == {port_type: sentinel.PORT_VALUE, "sentinel": sentinel.SENTINEL_VALUE}


@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="requires Python 3.7 or higher - sentinel doesn't behave well with deepcopy in Python 3.6",
)
@pytest.mark.parametrize("rule, expected", RULE_EXPANSION)
def test_rule_expand(rule, expected):
assert ec2_security_group_module.expand_rule(rule) == expected
Expand Down
Loading
Loading