Skip to content

Commit

Permalink
Remove deprecated "facts" aliases (#579)
Browse files Browse the repository at this point in the history
Remove deprecated "facts" aliases

SUMMARY
Modules named "facts.py" that do not return ansible_facts were renamed to "info.py" in 2.9. Remove these aliases now that the deprecation period is over.
This PR should be included in 3.0.0 of the collection.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
*_facts.py
ADDITIONAL INFORMATION
aws_az_facts.py has a deprecation date of 2022-06, so has not been removed.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
  • Loading branch information
jillr authored Dec 3, 2021
1 parent cf2b9aa commit bbdaf2c
Show file tree
Hide file tree
Showing 33 changed files with 24 additions and 203 deletions.
16 changes: 16 additions & 0 deletions changelogs/fragments/remove_deprecated_facts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
breaking_changes:
- aws_caller_facts - Remove deprecated ``aws_caller_facts`` alias. Please use ``aws_caller_info`` instead.
- cloudformation_facts - Remove deprecated ``cloudformation_facts`` alias. Please use ``cloudformation_info`` instead.
- ec2_ami_facts - Remove deprecated ``ec2_ami_facts`` alias. Please use ``ec2_ami_info`` instead.
- ec2_eni_facts - Remove deprecated ``ec2_eni_facts`` alias. Please use ``ec2_eni_info`` instead.
- ec2_group_facts - Remove deprecated ``ec2_group_facts`` alias. Please use ``ec2_group_info`` instead.
- ec2_instance_facts - Remove deprecated ``ec2_instance_facts`` alias. Please use ``ec2_instance_info`` instead.
- ec2_snapshot_facts - Remove deprecated ``ec2_snapshot_facts`` alias. Please use ``ec2_snapshot_info`` instead.
- ec2_vol_facts - Remove deprecated ``ec2_vol_facts`` alias. Please use ``ec2_vol_info`` instead.
- ec2_vpc_dhcp_option_facts - Remove deprecated ``ec2_vpc_dhcp_option_facts`` alias. Please use ``ec2_vpc_dhcp_option_info`` instead.
- ec2_vpc_endpoint_facts - Remove deprecated ``ec2_vpc_endpoint_facts`` alias. Please use ``ec2_vpc_endpoint_info`` instead.
- ec2_vpc_igw_facts - Remove deprecated ``ec2_vpc_igw_facts`` alias. Please use ``ec2_vpc_igw_info`` instead.
- ec2_vpc_nat_gateway_facts - Remove deprecated ``ec2_vpc_nat_gateway_facts`` alias. Please use ``ec2_vpc_nat_gateway_info`` instead.
- ec2_vpc_net_facts - Remove deprecated ``ec2_vpc_net_facts`` alias. Please use ``ec2_vpc_net_info`` instead.
- ec2_vpc_route_table_facts - Remove deprecated ``ec2_vpc_route_table_facts`` alias. Please use ``ec2_vpc_route_table_info`` instead.
- ec2_vpc_subnet_facts - Remove deprecated ``ec2_vpc_subnet_facts`` alias. Please use ``ec2_vpc_subnet_info`` instead.
98 changes: 0 additions & 98 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,47 @@ action_groups:
aws:
- aws_az_facts
- aws_az_info
- aws_caller_facts
- aws_caller_info
- aws_s3
- aws_s3
- aws_secret
- cloudformation
- cloudformation_facts
- cloudformation_info
- cloudfront_facts
- ec2
- ec2
- ec2
- ec2_ami
- ec2_ami_facts
- ec2_ami_info
- ec2_elb_lb
- ec2_eni
- ec2_eni_facts
- ec2_eni_info
- ec2_group
- ec2_group_facts
- ec2_group_info
- ec2_instance
- ec2_instance_facts
- ec2_instance_info
- ec2_key
- ec2_snapshot
- ec2_snapshot_facts
- ec2_snapshot_info
- ec2_spot_instance
- ec2_spot_instance_info
- ec2_tag
- ec2_tag_info
- ec2_vol
- ec2_vol_facts
- ec2_vol_info
- ec2_vpc_dhcp_option
- ec2_vpc_dhcp_option_facts
- ec2_vpc_dhcp_option_info
- ec2_vpc_endpoint
- ec2_vpc_endpoint_facts
- ec2_vpc_endpoint_info
- ec2_vpc_endpoint_service_info
- ec2_vpc_igw
- ec2_vpc_igw_facts
- ec2_vpc_igw_info
- ec2_vpc_nat_gateway
- ec2_vpc_nat_gateway_facts
- ec2_vpc_nat_gateway_info
- ec2_vpc_net
- ec2_vpc_net_facts
- ec2_vpc_net_info
- ec2_vpc_route_table
- ec2_vpc_route_table_facts
- ec2_vpc_route_table_info
- ec2_vpc_subnet
- ec2_vpc_subnet_facts
- ec2_vpc_subnet_info
- elb_classic_lb
- iam
Expand All @@ -73,33 +57,13 @@ plugin_routing:
warning_text: >-
aws_az_facts was renamed in Ansible 2.9 to aws_az_info.
Please update your tasks.
aws_caller_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
aws_caller_facts was renamed in Ansible 2.9 to aws_caller_info.
Please update your tasks.
cloudformation_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
cloudformation_facts has been deprecated and will be removed.
The cloudformation_info module returns the same information, but
not as ansible_facts. See the module documentation for more
information.
ec2:
deprecation:
removal_version: 4.0.0
warning_text: >-
The ec2 module is based upon a deprecated version of the AWS SDKs
and is deprecated in favor of the ec2_instance module.
Please update your tasks.
ec2_ami_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_ami_facts was renamed in Ansible 2.9 to ec2_ami_info.
Please update your tasks.
ec2_elb_lb:
redirect: amazon.aws.elb_classic_lb
ec2_eni_facts:
Expand All @@ -108,65 +72,3 @@ plugin_routing:
warning_text: >-
ec2_eni_facts was renamed in Ansible 2.9 to ec2_eni_info.
Please update your tasks.
ec2_group_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_group_facts was renamed in Ansible 2.9 to ec2_group_info.
Please update your tasks.
ec2_snapshot_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_snapshot_facts was renamed in Ansible 2.9 to ec2_snapshot_info.
Please update your tasks.
ec2_vol_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vol_facts was renamed in Ansible 2.9 to ec2_vol_info.
Please update your tasks.
ec2_vpc_dhcp_option_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_dhcp_option_facts was renamed in Ansible 2.9 to
ec2_vpc_dhcp_option_info. Please update your tasks.
ec2_vpc_net_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_net_facts was renamed in Ansible 2.9 to ec2_vpc_net_info.
Please update your tasks.
ec2_vpc_subnet_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_subnet_facts was renamed in Ansible 2.9 to
ec2_vpc_subnet_info. Please update your tasks.
ec2_vpc_endpoint_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_endpoint_facts was renamed in Ansible 2.9 to
ec2_vpc_endpoint_info.
ec2_vpc_igw_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_igw_facts was renamed in Ansible 2.9 to ec2_vpc_igw_info.
Please update your tasks.
ec2_vpc_route_table_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_route_table_facts was renamed in Ansible 2.9 to
ec2_vpc_route_table_info.
Please update your tasks.
ec2_vpc_nat_gateway_facts:
deprecation:
removal_date: 2021-12-01
warning_text: >-
ec2_vpc_nat_gateway_facts was renamed in Ansible 2.9 to
ec2_vpc_nat_gateway_info.
Please update your tasks.
1 change: 0 additions & 1 deletion plugins/modules/aws_caller_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/aws_caller_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
description:
- This module returns information about the account and user / role from which the AWS access tokens originate.
- The primary use of this is to get the account id for templating into ARNs or similar to avoid needing to specify this information in inventory.
- This module was called M(amazon.aws.aws_caller_facts) before Ansible 2.9. The usage did not change.
author:
- Ed Costello (@orthanc)
Expand Down Expand Up @@ -75,8 +74,6 @@ def main():
argument_spec={},
supports_check_mode=True,
)
if module._name == 'aws_caller_facts':
module.deprecate("The 'aws_caller_facts' module has been renamed to 'aws_caller_info'", date='2021-12-01', collection_name='amazon.aws')

client = module.client('sts', retry_decorator=AWSRetry.jittered_backoff())

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/cloudformation_facts.py

This file was deleted.

40 changes: 8 additions & 32 deletions plugins/modules/cloudformation_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
short_description: Obtain information about an AWS CloudFormation stack
description:
- Gets information about an AWS CloudFormation stack.
- This module was called C(amazon.aws.cloudformation_facts) before Ansible 2.9, returning C(ansible_facts).
Note that the M(amazon.aws.cloudformation_info) module no longer returns C(ansible_facts)!
author:
- Justin Menga (@jmenga)
- Kevin Coming (@waffie1)
Expand Down Expand Up @@ -70,16 +68,6 @@
- debug:
msg: "{{ output['cloudformation']['my-cloudformation-stack'] }}"
# When the module is called as cloudformation_facts, return values are published
# in ansible_facts['cloudformation'][<stack_name>] and can be used as follows.
# Note that this is deprecated and will stop working in Ansible after 2021-12-01.
- amazon.aws.cloudformation_facts:
stack_name: my-cloudformation-stack
- debug:
msg: "{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}"
# Get stack outputs, when you have the stack name available as a fact
- set_fact:
stack_name: my-awesome-stack
Expand All @@ -103,7 +91,7 @@
stack_policy: true
# Fail if the stack doesn't exist
- name: try to get facts about a stack but fail if it doesn't exist
- name: try to get info about a stack but fail if it doesn't exist
amazon.aws.cloudformation_info:
stack_name: nonexistent-stack
all_facts: yes
Expand Down Expand Up @@ -291,17 +279,9 @@ def main():
)
module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)

is_old_facts = module._name == 'cloudformation_facts'
if is_old_facts:
module.deprecate("The 'cloudformation_facts' module has been renamed to 'cloudformation_info', "
"and the renamed one no longer returns ansible_facts", date='2021-12-01', collection_name='amazon.aws')

service_mgr = CloudFormationServiceManager(module)

if is_old_facts:
result = {'ansible_facts': {'cloudformation': {}}}
else:
result = {'cloudformation': {}}
result = {'cloudformation': {}}

for stack_description in service_mgr.describe_stacks(module.params.get('stack_name')):
facts = {'stack_description': stack_description}
Expand Down Expand Up @@ -329,16 +309,12 @@ def main():
if all_facts or module.params.get('stack_change_sets'):
facts['stack_change_sets'] = service_mgr.describe_stack_change_sets(stack_name)

if is_old_facts:
result['ansible_facts']['cloudformation'][stack_name] = facts
else:
result['cloudformation'][stack_name] = camel_dict_to_snake_dict(facts, ignore_list=('stack_outputs',
'stack_parameters',
'stack_policy',
'stack_resources',
'stack_tags',
'stack_template'))

result['cloudformation'][stack_name] = camel_dict_to_snake_dict(facts, ignore_list=('stack_outputs',
'stack_parameters',
'stack_policy',
'stack_resources',
'stack_tags',
'stack_template'))
module.exit_json(changed=False, **result)


Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_ami_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/ec2_ami_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
short_description: Gather information about ec2 AMIs
description:
- Gather information about ec2 AMIs
- This module was called C(amazon.aws.ec2_ami_facts) before Ansible 2.9. The usage did not change.
author:
- Prasad Katti (@prasadkatti)
options:
Expand Down Expand Up @@ -274,8 +273,6 @@ def main():
)

module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
if module._module._name == 'ec2_ami_facts':
module._module.deprecate("The 'ec2_ami_facts' module has been renamed to 'ec2_ami_info'", date='2021-12-01', collection_name='amazon.aws')

ec2_client = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff())

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_eni_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/ec2_eni_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
short_description: Gather information about ec2 ENI interfaces in AWS
description:
- Gather information about ec2 ENI interfaces in AWS.
- This module was called C(ec2_eni_facts) before Ansible 2.9. The usage did not change.
author: "Rob White (@wimnat)"
options:
eni_id:
Expand Down Expand Up @@ -285,8 +284,6 @@ def main():
]

module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
if module._name == 'ec2_eni_facts':
module.deprecate("The 'ec2_eni_facts' module has been renamed to 'ec2_eni_info'", date='2021-12-01', collection_name='amazon.aws')

connection = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff())

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_group_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/ec2_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
short_description: Gather information about ec2 security groups in AWS.
description:
- Gather information about ec2 security groups in AWS.
- This module was called C(amazon.aws.ec2_group_facts) before Ansible 2.9. The usage did not change.
author:
- Henrique Rodrigues (@Sodki)
options:
Expand Down Expand Up @@ -109,8 +108,6 @@ def main():
)

module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True)
if module._name == 'ec2_group_facts':
module.deprecate("The 'ec2_group_facts' module has been renamed to 'ec2_group_info'", date='2021-12-01', collection_name='amazon.aws')

connection = module.client('ec2', AWSRetry.jittered_backoff())

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_instance_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/ec2_instance_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
short_description: Gather information about ec2 instances in AWS
description:
- Gather information about ec2 instances in AWS
- This module was called C(ec2_instance_facts) before Ansible 2.9. The usage did not change.
author:
- Michael Schuett (@michaeljs1990)
- Rob White (@wimnat)
Expand Down Expand Up @@ -575,8 +574,6 @@ def main():
],
supports_check_mode=True,
)
if module._name == 'ec2_instance_facts':
module.deprecate("The 'ec2_instance_facts' module has been renamed to 'ec2_instance_info'", date='2021-12-01', collection_name='amazon.aws')

try:
connection = module.client('ec2')
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_snapshot_facts.py

This file was deleted.

3 changes: 0 additions & 3 deletions plugins/modules/ec2_snapshot_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
short_description: Gather information about ec2 volume snapshots in AWS
description:
- Gather information about ec2 volume snapshots in AWS.
- This module was called C(ec2_snapshot_facts) before Ansible 2.9. The usage did not change.
author:
- "Rob White (@wimnat)"
- Aubin Bikouo (@abikouo)
Expand Down Expand Up @@ -283,8 +282,6 @@ def main():
],
supports_check_mode=True
)
if module._name == 'ec2_snapshot_facts':
module.deprecate("The 'ec2_snapshot_facts' module has been renamed to 'ec2_snapshot_info'", date='2021-12-01', collection_name='amazon.aws')

connection = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff())

Expand Down
1 change: 0 additions & 1 deletion plugins/modules/ec2_vol_facts.py

This file was deleted.

Loading

0 comments on commit bbdaf2c

Please sign in to comment.