Skip to content

Commit

Permalink
Deprecate Camel- and Upper- case aliases (ansible-collections#795)
Browse files Browse the repository at this point in the history
Deprecate Camel- and Upper- case aliases

SUMMARY
Clean up aliases.
S3_URL is a quirk from the very early code base and wasn't cleaned up when the original cleanup was done (in 2014!)
The CamelCase parameters were originally for compatibility.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
s3_bucket
aws_s3
ec2_vpc_dhcp_option_info aliases
ec2_ami
ADDITIONAL INFORMATION
S3_URL is causing linting issues with the docs:
  /home/runner/work/_temp/docsbuild/rst/collections/amazon/aws/aws_s3_module.rst:1478: WARNING: Duplicate explicit target name: "ansible_collections.amazon.aws.aws_s3_module__parameter-s3_url".

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored May 2, 2022
1 parent bf36645 commit e8aa2c5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
8 changes: 8 additions & 0 deletions changelogs/fragments/795-deprecate-aliases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
deprecated_features:
- s3_bucket - The ``S3_URL`` alias for the s3_url option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- aws_s3 - The ``S3_URL`` alias for the s3_url option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- ec2_vpc_dhcp_option_info - The ``DryRun`` alias for the dry_run option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- ec2_vpc_dhcp_option_info - The ``DhcpOptionIds`` alias for the dhcp_option_ids option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- ec2_ami - The ``DeviceName`` alias for the device_name option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- ec2_ami - The ``VirtualName`` alias for the virtual_name option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
- ec2_ami - The ``NoDevice`` alias for the no_device option has been deprecated and will be removed in release 5.0.0 (https://github.com/ansible-collections/community.aws/pull/795).
4 changes: 3 additions & 1 deletion plugins/modules/aws_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
s3_url:
description:
- S3 URL endpoint for usage with Ceph, Eucalyptus and fakes3 etc. Otherwise assumes AWS.
- The S3_URL alias for this option has been deprecated and will be removed
in release 5.0.0.
aliases: [ S3_URL ]
type: str
dualstack:
Expand Down Expand Up @@ -925,7 +927,7 @@ def main():
overwrite=dict(aliases=['force'], default='always'),
prefix=dict(default=""),
retries=dict(aliases=['retry'], type='int', default=0),
s3_url=dict(aliases=['S3_URL']),
s3_url=dict(aliases=['S3_URL'], deprecated_aliases=[dict(name='S3_URL', version='5.0.0', collection_name='amazon.aws')]),
dualstack=dict(default='no', type='bool'),
rgw=dict(default='no', type='bool'),
src=dict(type='path'),
Expand Down
16 changes: 11 additions & 5 deletions plugins/modules/ec2_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,24 @@
type: str
description:
- The device name. For example C(/dev/sda).
- The C(DeviceName) alias had been deprecated and will be removed in
release 5.0.0.
required: yes
aliases: ['DeviceName']
virtual_name:
type: str
description:
- The virtual name for the device.
- See the AWS documentation for more detail U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html).
- Alias C(VirtualName) has been deprecated and will be removed after 2022-06-01.
- The C(VirtualName) alias has been deprecated and will be removed in
release 5.0.0.
aliases: ['VirtualName']
no_device:
type: bool
description:
- Suppresses the specified device included in the block device mapping of the AMI.
- Alias C(NoDevice) has been deprecated and will be removed after 2022-06-01.
- The C(NoDevice) alias has been deprecated and will be removed in
release 5.0.0.
aliases: ['NoDevice']
volume_type:
type: str
Expand Down Expand Up @@ -707,13 +711,15 @@ def rename_item_if_exists(dict_object, attribute, new_attribute, child_node=None

def main():
mapping_options = dict(
device_name=dict(type='str', aliases=['DeviceName'], required=True),
device_name=dict(
type='str', aliases=['DeviceName'], required=True,
deprecated_aliases=[dict(name='DeviceName', version='5.0.0', collection_name='amazon.aws')]),
virtual_name=dict(
type='str', aliases=['VirtualName'],
deprecated_aliases=[dict(name='VirtualName', date='2022-06-01', collection_name='amazon.aws')]),
deprecated_aliases=[dict(name='VirtualName', version='5.0.0', collection_name='amazon.aws')]),
no_device=dict(
type='bool', aliases=['NoDevice'],
deprecated_aliases=[dict(name='NoDevice', date='2022-06-01', collection_name='amazon.aws')]),
deprecated_aliases=[dict(name='NoDevice', version='5.0.0', collection_name='amazon.aws')]),
volume_type=dict(type='str'),
delete_on_termination=dict(type='bool'),
snapshot_id=dict(type='str'),
Expand Down
12 changes: 10 additions & 2 deletions plugins/modules/ec2_vpc_dhcp_option_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
dhcp_options_ids:
description:
- Get details of specific DHCP Option IDs.
- The C(DhcpOptionIds) alias has been deprecated and will be removed in
release 5.0.0.
aliases: ['DhcpOptionIds']
type: list
elements: str
dry_run:
description:
- Checks whether you have the required permissions to view the DHCP
Options.
- The C(DryRun) alias has been deprecated and will be removed in
release 5.0.0.
aliases: ['DryRun']
type: bool
default: false
Expand Down Expand Up @@ -178,8 +182,12 @@ def list_dhcp_options(client, module):
def main():
argument_spec = dict(
filters=dict(type='dict', default={}),
dry_run=dict(type='bool', default=False, aliases=['DryRun']),
dhcp_options_ids=dict(type='list', elements='str', aliases=['DhcpOptionIds'])
dry_run=dict(
type='bool', default=False, aliases=['DryRun'],
deprecated_aliases=[dict(name='DryRun', version='5.0.0', collection_name='amazon.aws')]),
dhcp_options_ids=dict(
type='list', elements='str', aliases=['DhcpOptionIds'],
deprecated_aliases=[dict(name='DhcpOptionIds', version='5.0.0', collection_name='amazon.aws')]),
)

module = AnsibleAWSModule(
Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/s3_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
- S3 URL endpoint for usage with DigitalOcean, Ceph, Eucalyptus and FakeS3 etc.
- Assumes AWS if not specified.
- For Walrus, use FQDN of the endpoint without scheme nor path.
- The S3_URL alias for this option has been deprecated and will be removed
in release 5.0.0.
aliases: [ S3_URL ]
type: str
ceph:
Expand Down Expand Up @@ -1007,7 +1009,7 @@ def main():
policy=dict(type='json'),
name=dict(required=True),
requester_pays=dict(type='bool'),
s3_url=dict(aliases=['S3_URL']),
s3_url=dict(aliases=['S3_URL'], deprecated_aliases=[dict(name='S3_URL', version='5.0.0', collection_name='amazon.aws')]),
state=dict(default='present', choices=['present', 'absent']),
tags=dict(type='dict'),
purge_tags=dict(type='bool', default=True),
Expand Down

0 comments on commit e8aa2c5

Please sign in to comment.