Skip to content

Commit

Permalink
Drop tests for botocore < 1.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Jan 24, 2023
1 parent 6958b2e commit c936895
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 59 deletions.
11 changes: 2 additions & 9 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
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:
Expand Down Expand Up @@ -1293,6 +1292,8 @@ def build_top_level_options(params):
'metadata_options').get('http_tokens')
spec['MetadataOptions']['HttpPutResponseHopLimit'] = params.get(
'metadata_options').get('http_put_response_hop_limit')
spec['MetadataOptions']['HttpProtocolIpv6'] = params.get(
'metadata_options').get('http_protocol_ipv6')

if not module.botocore_at_least('1.23.30'):
# fail only if enabled is requested
Expand All @@ -1302,14 +1303,6 @@ def build_top_level_options(params):
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')

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
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
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

0 comments on commit c936895

Please sign in to comment.