From 5b109506c4a4d1ecfdc9d77184ed1175f4275c95 Mon Sep 17 00:00:00 2001 From: Vinay Dandekar Date: Tue, 18 Jul 2017 16:11:09 -0400 Subject: [PATCH] [cloud] Rename ec2_facts to ec2_metadata_facts (#26293) - Update CHANGELOG with ec2_facts deprecation notice --- CHANGELOG.md | 4 ++++ lib/ansible/modules/cloud/amazon/_ec2_facts.py | 1 + .../{ec2_facts.py => ec2_metadata_facts.py} | 17 ++++++++++------- 3 files changed, 15 insertions(+), 7 deletions(-) create mode 120000 lib/ansible/modules/cloud/amazon/_ec2_facts.py rename lib/ansible/modules/cloud/amazon/{ec2_facts.py => ec2_metadata_facts.py} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 778da3ab5a..793c5a8434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,9 @@ Ansible Changes By Release module is deprecated and slated to go away in 2.8. The functionality has been moved to `ansible.utils.unsafe_proxy` to avoid a circular import. +#### Deprecated Modules: +* ec2_facts (removed in 2.7), replaced by ec2_metadata_facts + ### Minor Changes * removed previously deprecated config option `hostfile` and env var `ANSIBLE_HOSTS` * removed unused and deprecated config option `pattern` @@ -109,6 +112,7 @@ Ansible Changes By Release - aix_lvol - amazon + * ec2_metadata_facts * ec2_vpc_endpoint * iam_cert_facts * lightsail diff --git a/lib/ansible/modules/cloud/amazon/_ec2_facts.py b/lib/ansible/modules/cloud/amazon/_ec2_facts.py new file mode 120000 index 0000000000..2e5b1b9b3c --- /dev/null +++ b/lib/ansible/modules/cloud/amazon/_ec2_facts.py @@ -0,0 +1 @@ +ec2_metadata_facts.py \ No newline at end of file diff --git a/lib/ansible/modules/cloud/amazon/ec2_facts.py b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py similarity index 98% rename from lib/ansible/modules/cloud/amazon/ec2_facts.py rename to lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py index 6eb7b3314a..e915f7bf05 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_metadata_facts.py @@ -23,7 +23,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.0', DOCUMENTATION = ''' --- -module: ec2_facts +module: ec2_metadata_facts short_description: Gathers facts (instance metadata) about remote hosts within ec2 version_added: "1.0" author: @@ -34,12 +34,12 @@ description: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html. The module must be called from within the EC2 instance itself. notes: - - Parameters to filter on ec2_facts may be added later. + - Parameters to filter on ec2_metadata_facts may be added later. ''' EXAMPLES = ''' -# Gather EC2 facts -- ec2_facts: +# Gather EC2 metadata facts +- ec2_metadata_facts: - debug: msg: "This instance is a t1.micro" @@ -539,10 +539,13 @@ def main(): supports_check_mode=True, ) - ec2_facts = Ec2Metadata(module).run() - ec2_facts_result = dict(changed=False, ansible_facts=ec2_facts) + if module._name == 'ec2_facts': + module.deprecate("The 'ec2_facts' module is being renamed 'ec2_metadata_facts'", version=2.7) - module.exit_json(**ec2_facts_result) + ec2_metadata_facts = Ec2Metadata(module).run() + ec2_metadata_facts_result = dict(changed=False, ansible_facts=ec2_metadata_facts) + + module.exit_json(**ec2_metadata_facts_result) if __name__ == '__main__':