Skip to content

Commit

Permalink
Drop tests for botocore < 1.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Feb 10, 2023
1 parent 51fd52f commit 0029dce
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 89 deletions.
22 changes: 4 additions & 18 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,15 +359,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: 4.0.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'
Expand Down Expand Up @@ -1290,22 +1288,10 @@ def build_top_level_options(params):
'metadata_options').get('http_tokens')
spec['MetadataOptions']['HttpPutResponseHopLimit'] = params.get(
'metadata_options').get('http_put_response_hop_limit')

if not module.botocore_at_least('1.23.30'):
# fail only if enabled is requested
if params.get('metadata_options').get('instance_metadata_tags') == 'enabled':
module.require_botocore_at_least('1.23.30', reason='to set instance_metadata_tags')
else:
spec['MetadataOptions']['InstanceMetadataTags'] = params.get(
'metadata_options').get('instance_metadata_tags')

if not module.botocore_at_least('1.21.29'):
# fail only if enabled is requested
if params.get('metadata_options').get('http_protocol_ipv6') == 'enabled':
module.require_botocore_at_least('1.21.29', reason='to set http_protocol_ipv6')
else:
spec['MetadataOptions']['HttpProtocolIpv6'] = params.get(
'metadata_options').get('http_protocol_ipv6')
spec['MetadataOptions']['HttpProtocolIpv6'] = params.get(
'metadata_options').get('http_protocol_ipv6')
spec['MetadataOptions']['InstanceMetadataTags'] = params.get(
'metadata_options').get('instance_metadata_tags')

return spec

Expand Down
3 changes: 0 additions & 3 deletions plugins/modules/ec2_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
EC2 Instance Connect, and EC2 Serial Console.
- By default Amazon will create an RSA key.
- Mutually exclusive with parameter I(key_material).
- Requires at least botocore version 1.21.23.
type: str
choices:
- rsa
Expand Down Expand Up @@ -362,8 +361,6 @@ def main():

result = {}

if key_type:
module.require_botocore_at_least('1.21.23', reason='to set the key_type for a keypair')
try:
if state == 'absent':
result = delete_key_pair(module.check_mode, ec2_client, name)
Expand Down
6 changes: 0 additions & 6 deletions plugins/modules/lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
description:
- The instruction set architecture that the function supports.
- Requires one of I(s3_bucket) or I(zip_file).
- Requires botocore >= 1.21.51.
type: str
choices: ['x86_64', 'arm64']
aliases: ['architectures']
Expand Down Expand Up @@ -239,7 +238,6 @@
contains:
architectures:
description: The architectures supported by the function.
returned: successful run where botocore >= 1.21.51
type: list
elements: str
sample: ['arm64']
Expand Down Expand Up @@ -643,10 +641,6 @@ def main():
check_mode = module.check_mode
changed = False

if architectures:
module.require_botocore_at_least(
'1.21.51', reason='to configure the architectures that the function supports.')

try:
client = module.client('lambda', retry_decorator=AWSRetry.jittered_backoff())
except (ClientError, BotoCoreError) as e:
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/rds_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
- The storage throughput when the I(storage_type) is C(gp3).
- When the allocated storage is below 400 GB, the storage throughput will always be 125 mb/s.
- When the allocated storage is large than or equal 400 GB, the througput starts at 500 mb/s.
- Requires boto3 >= 1.26.0.
- Requires botocore >= 1.29.0.
type: int
version_added: 5.2.0
tde_credential_arn:
Expand Down Expand Up @@ -1010,15 +1010,15 @@ def get_options_with_changing_values(client, module, parameters):
parameters['Iops'] = new_iops

if instance.get('StorageType') == 'gp3':
if module.boto3_at_least('1.26.0'):
if module.botocore_at_least('1.29.0'):
GP3_THROUGHPUT = True
current_storage_throughput = instance.get('PendingModifiedValues', {}).get('StorageThroughput', instance['StorageThroughput'])
new_storage_throughput = module.params.get('storage_throughput') or current_storage_throughput
if new_storage_throughput != current_storage_throughput:
parameters['StorageThroughput'] = new_storage_throughput
else:
GP3_THROUGHPUT = False
module.warn('gp3 volumes require boto3 >= 1.26.0. storage_throughput will be ignored.')
module.warn('gp3 volumes require botocore >= 1.29.0. storage_throughput will be ignored.')

current_iops = instance.get('PendingModifiedValues', {}).get('Iops', instance['Iops'])
# when you just change from gp2 to gp3, you may not add the iops parameter
Expand Down
4 changes: 0 additions & 4 deletions plugins/modules/s3_object_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
object_attributes:
description:
- Retreive S3 object attributes.
- Requires minimum botocore version 1.24.7.
required: false
type: bool
default: false
Expand Down Expand Up @@ -724,9 +723,6 @@ def main():
if object_name:
object_check(connection, module, bucket_name, object_name)

if requested_object_details and requested_object_details['object_attributes']:
module.require_botocore_at_least('1.24.7', reason='required for s3.get_object_attributes')

if requested_object_details:
if object_name:
object_details = get_object_details(connection, module, bucket_name, object_name, requested_object_details)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ dependencies:
- role: setup_ec2_instance_env
vars:
ec2_instance_test_name: hibernation_options
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
3 changes: 0 additions & 3 deletions tests/integration/targets/ec2_key/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
dependencies:
- setup_sshkey
- role: setup_botocore_pip
vars:
botocore_version: "1.21.23"
18 changes: 0 additions & 18 deletions tests/integration/targets/ec2_key/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,27 +389,11 @@
- 'result.key == None'

# ============================================================
- name: test create ED25519 key pair type with botocore <= 1.21.23
ec2_key:
name: '{{ ec2_key_name }}'
key_type: ed25519
ignore_errors: true
register: result

- name: assert that task failed
assert:
that:
- 'result.failed'
- '"Failed to import the required Python library (botocore>=1.21.23)" in result.msg'
- '"This is required to set the key_type for a keypair" in result.msg'

- name: test create ED25519 key pair type
ec2_key:
name: '{{ ec2_key_name }}'
key_type: ed25519
register: result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: assert that task succeed
assert:
Expand All @@ -422,8 +406,6 @@
name: '{{ ec2_key_name }}'
key_type: rsa
register: result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: assert that task succeed
assert:
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/targets/ec2_metadata_facts/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
dependencies:
- setup_ec2_facts
- setup_sshkey
#required for run_instances with MetadataOptions.InstanceMetadataTags
- role: setup_botocore_pip
vars:
botocore_version: '1.23.30'
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
- include_role:
name: '../setup_ec2_facts'

- include_role:
name: '../setup_botocore_pip'
vars:
botocore_version: '1.23.30'

- set_fact:
availability_zone: '{{ ec2_availability_zone_names[0] }}'

Expand Down Expand Up @@ -128,8 +123,6 @@
camelCaseKey: aCamelCaseValue
wait: True
register: ec2_instance
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- set_fact:
ec2_instance_id: "{{ ec2_instance.instances[0].instance_id }}"
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/targets/lambda/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.21.51
- role: setup_remote_tmp_dir
6 changes: 0 additions & 6 deletions tests/integration/targets/lambda/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@
role: '{{ lambda_role_name }}'
zip_file: '{{ zip_res.dest }}'
architecture: arm64
vars:
ansible_python_interpreter: '{{ botocore_virtualenv_interpreter }}'
register: result
check_mode: yes
- name: assert lambda upload succeeded
Expand All @@ -174,8 +172,6 @@
role: '{{ lambda_role_name }}'
zip_file: '{{ zip_res.dest }}'
architecture: arm64
vars:
ansible_python_interpreter: '{{ botocore_virtualenv_interpreter }}'
register: result
- name: assert lambda upload succeeded
assert:
Expand Down Expand Up @@ -329,8 +325,6 @@
query: all
register: lambda_infos_all
check_mode: yes
vars:
ansible_python_interpreter: '{{ botocore_virtualenv_interpreter }}'
- name: lambda_info | Assert successfull retrieval of all information 1
vars:
lambda_info: "{{ lambda_infos_all.functions | selectattr('function_name', 'eq', lambda_function_name) | first }}"
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/targets/lambda_event/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
dependencies:
- role: setup_remote_tmp_dir
- role: setup_botocore_pip
vars:
botocore_version: 1.21.51
2 changes: 0 additions & 2 deletions tests/integration/targets/lambda_event/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
zip_file: '{{ zip_res.dest }}'
architecture: x86_64
register: result
vars:
ansible_python_interpreter: '{{ botocore_virtualenv_interpreter }}'

- name: assert lambda upload succeeded
assert:
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/targets/s3_object/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
dependencies:
- setup_remote_tmp_dir
# required for s3.get_object_attributes
- role: setup_botocore_pip
vars:
botocore_version: '1.24.7'
2 changes: 0 additions & 2 deletions tests/integration/targets/s3_object/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
- Checksum
- ObjectParts
register: info_detail_result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- assert:
that:
Expand Down

0 comments on commit 0029dce

Please sign in to comment.