diff --git a/changelogs/fragments/57035-facts-info-rename.yaml b/changelogs/fragments/57035-facts-info-rename.yaml new file mode 100644 index 00000000000..920e8a0fffe --- /dev/null +++ b/changelogs/fragments/57035-facts-info-rename.yaml @@ -0,0 +1,2 @@ +minor_changes: +- The ``one_image_facts`` module has been renamed to ``one_image_info``. diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.9.rst b/docs/docsite/rst/porting_guides/porting_guide_2.9.rst index 43b8e2ea419..e92b8bf4798 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.9.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.9.rst @@ -75,6 +75,7 @@ Noteworthy module changes * The ``k8s_facts`` module was renamed to :ref:`k8s_info `. * The ``bigip_device_facts`` module was renamed to :ref:`bigip_device_info `. * The ``bigiq_device_facts`` module was renamed to :ref:`bigiq_device_info `. +* The ``one_image_facts`` module was renamed to :ref:`one_image_info `. Plugins diff --git a/lib/ansible/modules/cloud/opennebula/_one_image_facts.py b/lib/ansible/modules/cloud/opennebula/_one_image_facts.py new file mode 120000 index 00000000000..96b83573168 --- /dev/null +++ b/lib/ansible/modules/cloud/opennebula/_one_image_facts.py @@ -0,0 +1 @@ +one_image_info.py \ No newline at end of file diff --git a/lib/ansible/modules/cloud/opennebula/one_image_facts.py b/lib/ansible/modules/cloud/opennebula/one_image_info.py similarity index 94% rename from lib/ansible/modules/cloud/opennebula/one_image_facts.py rename to lib/ansible/modules/cloud/opennebula/one_image_info.py index f0c2d4908ec..c0f82541e70 100644 --- a/lib/ansible/modules/cloud/opennebula/one_image_facts.py +++ b/lib/ansible/modules/cloud/opennebula/one_image_info.py @@ -30,10 +30,11 @@ ANSIBLE_METADATA = {'status': ['preview'], DOCUMENTATION = ''' --- -module: one_image_facts -short_description: Gather facts about OpenNebula images +module: one_image_info +short_description: Gather information on OpenNebula images description: - - Gather facts about OpenNebula images + - Gather information on OpenNebula images. + - This module was called C(one_image_facts) before Ansible 2.9. The usage did not change. version_added: "2.6" requirements: - python-oca @@ -69,7 +70,7 @@ author: EXAMPLES = ''' # Gather facts about all images -- one_image_facts: +- one_image_info: register: result # Print all images facts @@ -77,22 +78,22 @@ EXAMPLES = ''' msg: result # Gather facts about an image using ID -- one_image_facts: +- one_image_info: ids: - 123 # Gather facts about an image using the name -- one_image_facts: +- one_image_info: name: 'foo-image' register: foo_image # Gather facts about all IMAGEs whose name matches regex 'app-image-.*' -- one_image_facts: +- one_image_info: name: '~app-image-.*' register: app_images # Gather facts about all IMAGEs whose name matches regex 'foo-image-.*' ignoring cases -- one_image_facts: +- one_image_info: name: '~*foo-image-.*' register: foo_images ''' @@ -262,6 +263,8 @@ def main(): module = AnsibleModule(argument_spec=fields, mutually_exclusive=[['ids', 'name']], supports_check_mode=True) + if module._name == 'one_image_facts': + module.deprecate("The 'one_image_facts' module has been renamed to 'one_image_info'", version='2.13') if not HAS_OCA: module.fail_json(msg='This module requires python-oca to work!') diff --git a/test/legacy/opennebula.yml b/test/legacy/opennebula.yml index d5607cb5731..66f38d904e0 100644 --- a/test/legacy/opennebula.yml +++ b/test/legacy/opennebula.yml @@ -3,5 +3,5 @@ roles: - { role: one_vm, tags: test_one_vm } - { role: one_image, tags: test_one_image } - - { role: one_image_facts, tags: test_one_image_facts } + - { role: one_image_info, tags: test_one_image_info } - { role: one_service, tags: test_one_service } diff --git a/test/legacy/roles/one_image_facts/defaults/main.yml b/test/legacy/roles/one_image_info/defaults/main.yml similarity index 80% rename from test/legacy/roles/one_image_facts/defaults/main.yml rename to test/legacy/roles/one_image_info/defaults/main.yml index 8eb1adf9498..0f8c3eb24ba 100644 --- a/test/legacy/roles/one_image_facts/defaults/main.yml +++ b/test/legacy/roles/one_image_info/defaults/main.yml @@ -1,5 +1,5 @@ --- -# This is a role for running integration test of the one_image_facts module. +# This is a role for running integration test of the one_image_info module. # For this role to be used you need to meet the following prerequisites: # 1. Environment variables ONE_URL, ONE_USERNAME and ONE_PASSWORD # need to be set. diff --git a/test/legacy/roles/one_image_facts/tasks/main.yml b/test/legacy/roles/one_image_info/tasks/main.yml similarity index 95% rename from test/legacy/roles/one_image_facts/tasks/main.yml rename to test/legacy/roles/one_image_info/tasks/main.yml index bebe0d39166..9eb2f9610a2 100644 --- a/test/legacy/roles/one_image_facts/tasks/main.yml +++ b/test/legacy/roles/one_image_info/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Fetch all images - one_image_facts: + one_image_info: register: all_images - name: Print all images @@ -8,7 +8,7 @@ var: all_images - name: Gather facts about an image using a name - one_image_facts: + one_image_info: name: '{{ one_image_name }}' register: image_with_name @@ -22,7 +22,7 @@ - image_with_name.images[0].running_vms == 0 - name: Gather facts about the image using ID - one_image_facts: + one_image_info: id: '{{ image_with_name.images[0].id }}' register: image_with_ids @@ -36,20 +36,20 @@ - image_with_ids.images[0].running_vms == 0 - name: Try to gather facts about an image using a name and ids - one_image_facts: + one_image_info: name: '{{ one_image_name }}' id: '{{ image_with_name.images[0].id }}' register: image_name_ids failed_when: not image_name_ids is failed - name: Try to fetch non-existent image by name - one_image_facts: + one_image_info: name: non-existent-vm-{{ ansible_date_time.iso8601_basic_short }} register: image_missing failed_when: not image_missing is failed - name: Try to gather facts about non-existent images by regex - one_image_facts: + one_image_info: name: ~non-existent-vm-{{ ansible_date_time.iso8601_basic_short }}-* register: images_with_regex @@ -60,7 +60,7 @@ - images_with_regex.images|length == 0 - name: Try to fetch non-existent image by id - one_image_facts: + one_image_info: id: -999 register: image_missing failed_when: not image_missing is failed @@ -79,7 +79,7 @@ new_name: '{{ one_image_name }}-clone-2' - name: Fetch all images whose name matches regex - one_image_facts: + one_image_info: name: '~{{ one_image_name }}-clone-[12]$' register: cloned_instances @@ -93,7 +93,7 @@ msg: "There should be 2 cloned instances" - name: Gather facts about all images using IDs - one_image_facts: + one_image_info: ids: - '{{ cloned_instances.images[0].id }}' - '{{ cloned_instances.images[1].id }}' @@ -115,7 +115,7 @@ new_name: '{{ one_image_name }}-CLONE-2' - name: Fetch all images whose name matches regex - one_image_facts: + one_image_info: name: '~{{ one_image_name }}-clone-[12]$' register: cloned_instances @@ -128,7 +128,7 @@ msg: "There should be 1 cloned instance" - name: Fetch all images whose name matches regex ignoring cases - one_image_facts: + one_image_info: name: '~*{{ one_image_name }}-clone-[12]$' register: cloned_instances_case_insensitive