Skip to content

Commit

Permalink
redefined-outer-name
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Apr 10, 2024
1 parent 9e0436b commit 87013fb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions changelogs/fragments/sanity-boto3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
deprecated_features:
- module_utils.botocore - the ``boto3`` parameter for ``get_aws_region()`` will be removed in a release after 2025-05-01.
The ``boto3`` parameter has been ignored since release 4.0.0 (https://github.com/ansible-collections/amazon.aws/pull/2047).
- module_utils.botocore - the ``boto3`` parameter for ``get_aws_connection_info()`` will be removed in a release after 2025-05-01.
The ``boto3`` parameter has been ignored since release 4.0.0 (https://github.com/ansible-collections/amazon.aws/pull/2047).
- module_utils.ec2 - the ``boto3`` parameter for ``get_ec2_security_group_ids_from_names()`` will be removed in a release after 2025-05-01.
The ``boto3`` parameter has been ignored since release 4.0.0 (https://github.com/ansible-collections/amazon.aws/pull/2047).
18 changes: 16 additions & 2 deletions plugins/module_utils/botocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,14 @@ def _aws_region(params):
return None


def get_aws_region(module, boto3=None):
def get_aws_region(module, boto3=None): # pylint: disable=redefined-outer-name
if boto3 is not None:
module.deprecate(
"get_aws_region(): the boto3 parameter will be removed in a release after 2025-05-01. "
"The parameter has been ignored since release 4.0.0.",
date="2025-05-01",
collection_name="amazon.aws",
)
try:
return _aws_region(module.params)
except AnsibleBotocoreError as e:
Expand Down Expand Up @@ -266,7 +273,14 @@ def _aws_connection_info(params):
return region, endpoint_url, boto_params


def get_aws_connection_info(module, boto3=None):
def get_aws_connection_info(module, boto3=None): # pylint: disable=redefined-outer-name
if boto3 is not None:
module.deprecate(
"get_aws_connection_info(): the boto3 parameter will be removed in a release after 2025-05-01. "
"The parameter has been ignored since release 4.0.0.",
date="2025-05-01",
collection_name="amazon.aws",
)
try:
return _aws_connection_info(module.params)
except AnsibleBotocoreError as e:
Expand Down
11 changes: 11 additions & 0 deletions plugins/module_utils/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import re

import ansible.module_utils.common.warnings as ansible_warnings
from ansible.module_utils.ansible_release import __version__

# Used to live here, moved into ansible.module_utils.common.dict_transformations
Expand Down Expand Up @@ -105,6 +106,16 @@ def get_sg_name(sg):
def get_sg_id(sg):
return str(sg["GroupId"])

if boto3 is not None:
ansible_warnings.deprecate(
(
"The boto3 parameter for get_ec2_security_group_ids_from_names() has been deprecated."
"The parameter has been ignored since release 4.0.0."
),
date="2025-05-01",
collection_name="amazon.aws",
)

sec_group_id_list = []

if isinstance(sec_group_list, string_types):
Expand Down

0 comments on commit 87013fb

Please sign in to comment.