Rename one_image_facts -> one_image_info (#57035)

* Rename one_image_facts -> one_image_info.

* Add changelog.

* Forgot symlink.
This commit is contained in:
Felix Fontein 2019-05-29 21:23:25 +02:00 committed by GitHub
parent ba18dd713a
commit c47e9d22b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 21 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- The ``one_image_facts`` module has been renamed to ``one_image_info``.

View file

@ -75,6 +75,7 @@ Noteworthy module changes
* The ``k8s_facts`` module was renamed to :ref:`k8s_info <k8s_info_module>`.
* The ``bigip_device_facts`` module was renamed to :ref:`bigip_device_info <bigip_device_info_module>`.
* The ``bigiq_device_facts`` module was renamed to :ref:`bigiq_device_info <bigiq_device_info_module>`.
* The ``one_image_facts`` module was renamed to :ref:`one_image_info <one_image_info_module>`.
Plugins

View file

@ -0,0 +1 @@
one_image_info.py

View file

@ -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!')

View file

@ -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 }

View file

@ -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.

View file

@ -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