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

[4.0.0] Bump minimum botocore version to 1.20.0 #692

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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ As the AWS SDK for Python (Boto3 and Botocore) has [ceased supporting Python 2.7

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 3.0.0 of this collection supports `boto3 >= 1.16.0` and `botocore >= 1.19.0`
Version 4.0.0 of this collection supports `boto3 >= 1.17.0` and `botocore >= 1.20.0`

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

Expand Down
7 changes: 7 additions & 0 deletions changelogs/fragments/release-4--botocore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
major_changes:
- amazon.aws collection - The amazon.aws collection has dropped support for
``botocore<1.20.0`` and ``boto3<1.17.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/574).
4 changes: 2 additions & 2 deletions plugins/doc_fragments/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class ModuleDocFragment(object):
type: dict
requirements:
- python >= 3.6
- boto3 >= 1.16.0
- botocore >= 1.19.0
- boto3 >= 1.17.0
- botocore >= 1.20.0
notes:
- If parameters are not set within the module, the following
environment variables can be used in decreasing order of precedence
Expand Down
2 changes: 1 addition & 1 deletion plugins/lookup/aws_account_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
requirements:
- python >= 3.6
- boto3
- botocore >= 1.19.0
- botocore >= 1.20.0
extends_documentation_fragment:
- amazon.aws.aws_credentials
- amazon.aws.aws_region
Expand Down
2 changes: 1 addition & 1 deletion plugins/lookup/aws_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
requirements:
- python >= 3.6
- boto3
- botocore >= 1.19.0
- botocore >= 1.20.0
extends_documentation_fragment:
- amazon.aws.aws_credentials
- amazon.aws.aws_region
Expand Down
2 changes: 1 addition & 1 deletion plugins/lookup/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
requirements:
- python >= 3.6
- boto3
- botocore >= 1.19.0
- botocore >= 1.20.0
short_description: Get the value for a SSM parameter or all parameters under a path.
description:
- Get the value for an Amazon Simple Systems Manager parameter or a hierarchy of parameters.
Expand Down
8 changes: 4 additions & 4 deletions plugins/module_utils/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ def __init__(self, **kwargs):
self._module.fail_json(
msg=missing_required_lib('botocore or boto3'))
current_versions = self._gather_versions()
if not self.botocore_at_least('1.19.0'):
self.warn('botocore < 1.19.0 is not supported or tested.'
if not self.botocore_at_least('1.20.0'):
self.warn('botocore < 1.20.0 is not supported or tested.'
' Some features may not work.')
if not self.boto3_at_least("1.16.0"):
self.warn('boto3 < 1.16.0 is not supported or tested.'
if not self.boto3_at_least("1.17.0"):
self.warn('boto3 < 1.17.0 is not supported or tested.'
' Some features may not work.')

self.check_mode = self._module.check_mode
Expand Down
5 changes: 3 additions & 2 deletions plugins/modules/ec2_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,9 @@ def create_image(module, connection):
if instance_id:
params['InstanceId'] = instance_id
params['NoReboot'] = no_reboot
if tags and module.botocore_at_least('1.19.30'):
params['TagSpecifications'] = boto3_tag_specifications(tags, types=['image', 'snapshot'])
tag_spec = boto3_tag_specifications(tags, types=['image', 'snapshot'])
if tag_spec:
params['TagSpecifications'] = tag_spec
image_id = connection.create_image(aws_retry=True, **params).get('ImageId')
else:
if architecture:
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
- A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage.
- A mapping contains the (optional) keys device_name, virtual_name, ebs.volume_type, ebs.volume_size, ebs.kms_key_id,
ebs.iops, and ebs.delete_on_termination.
- Set ebs.throughput value requires botocore>=1.19.27.
- For more information about each parameter, see U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html).
type: list
elements: dict
Expand Down Expand Up @@ -987,7 +986,6 @@ def build_volume_spec(params):
if not volume['ebs'].get('iops'):
volume['ebs']['iops'] = 3000
if 'throughput' in volume['ebs']:
module.require_botocore_at_least('1.19.27', reason='to set throughtput value')
volume['ebs']['throughput'] = int(volume['ebs']['throughput'])
else:
volume['ebs']['throughput'] = 125
Expand Down
10 changes: 2 additions & 8 deletions plugins/modules/ec2_vol.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
- Volume throughput in MB/s.
- This parameter is only valid for gp3 volumes.
- Valid range is from 125 to 1000.
- Requires at least botocore version 1.19.27.
type: int
version_added: 1.4.0
multi_attach:
Expand Down Expand Up @@ -450,8 +449,7 @@ def update_volume(module, ec2_conn, volume):
volume['volume_type'] = response.get('VolumeModification').get('TargetVolumeType')
volume['iops'] = response.get('VolumeModification').get('TargetIops')
volume['multi_attach_enabled'] = response.get('VolumeModification').get('TargetMultiAttachEnabled')
if module.botocore_at_least("1.19.27"):
volume['throughput'] = response.get('VolumeModification').get('TargetThroughput')
volume['throughput'] = response.get('VolumeModification').get('TargetThroughput')

return volume, changed

Expand Down Expand Up @@ -679,8 +677,7 @@ def get_volume_info(module, volume, tags=None):
'tags': tags
}

if module.botocore_at_least("1.19.27"):
volume_info['throughput'] = volume.get('throughput')
volume_info['throughput'] = volume.get('throughput')

return volume_info

Expand Down Expand Up @@ -759,9 +756,6 @@ def main():
module.deprecate(
'Using the "list" state has been deprecated. Please use the ec2_vol_info module instead', date='2022-06-01', collection_name='amazon.aws')

if module.params.get('throughput'):
module.require_botocore_at_least('1.19.27', reason='to set the throughput for a volume')

# Ensure we have the zone or can get the zone
if instance is None and zone is None and state == 'present':
module.fail_json(msg="You must specify either instance or zone")
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.19.0
boto3>=1.16.0
botocore>=1.20.0
boto3>=1.17.0
6 changes: 3 additions & 3 deletions tests/integration/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.16.0
botocore==1.19.0
boto3==1.17.0
botocore==1.20.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.18.160
awscli==1.19.0
1 change: 0 additions & 1 deletion tests/integration/targets/ec2_instance/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_botocore_pip
- role: prepare_tests
- role: setup_ec2_facts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
- block:
- include_role:
name: setup_botocore_pip
vars:
botocore_version: '1.19.27'

- name: "New instance with an extra block device"
ec2_instance:
Expand Down Expand Up @@ -98,9 +94,6 @@
instance_type: "{{ ec2_instance_type }}"
wait: true
register: block_device_instances_gp3
# Managing Troughput requires botocore >= 1.19.27
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- assert:
that:
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/targets/ec2_vol/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.19.27'
- role: setup_ec2_facts
10 changes: 0 additions & 10 deletions tests/integration/targets/ec2_vol/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,6 @@
- new_vol_attach_result.volume.tags["Name"] == '{{ resource_prefix }} - sdh'

- name: volume must be from type gp3 (idempotent)
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
ec2_vol:
id: "{{ new_vol_attach_result.volume_id }}"
zone: "{{ availability_zone }}"
Expand Down Expand Up @@ -727,8 +725,6 @@
when: ansible_version.full is version('2.7', '>=')

- name: test create a new gp3 volume
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
ec2_vol:
volume_size: 70
zone: "{{ availability_zone }}"
Expand Down Expand Up @@ -760,8 +756,6 @@
- gp3_volume.volume.tags["ResourcePrefix"] == "{{ resource_prefix }}"

- name: Read volume information to validate throughput
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
ec2_vol_info:
filters:
volume-id: "{{ gp3_volume.volume_id }}"
Expand All @@ -779,8 +773,6 @@
var: vol_facts

- name: Read volume information to validate throughput
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
ec2_vol_info:
filters:
volume-id: "{{ gp3_volume.volume_id }}"
Expand All @@ -798,8 +790,6 @@
var: vol_facts

- name: increase throughput
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
ec2_vol:
volume_size: 70
zone: "{{ availability_zone }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
default_botocore_version: '1.19.0'
default_boto3_version: '1.16.0'
default_botocore_version: '1.20.0'
default_boto3_version: '1.17.0'
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.16.0
botocore==1.19.0
boto3==1.17.0
botocore==1.20.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.18.160
awscli==1.19.0
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class TestMinimalVersions(object):
# Prepare some data for use in our testing
# ========================================================
def setup_method(self):
self.MINIMAL_BOTO3 = '1.16.0'
self.MINIMAL_BOTOCORE = '1.19.0'
self.OLD_BOTO3 = '1.15.999'
self.OLD_BOTOCORE = '1.18.999'
self.MINIMAL_BOTO3 = '1.17.0'
self.MINIMAL_BOTOCORE = '1.20.0'
self.OLD_BOTO3 = '1.16.999'
self.OLD_BOTOCORE = '1.19.999'

# ========================================================
# Test we don't warn when using valid versions
Expand Down