mirror of https://github.com/ansible/ansible.git
validate-modules: check_mode attribute and compare with supports_check_mode parameter (#80090)
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>pull/80284/head
parent
5388f6020a
commit
4ea50cef23
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- "validate-modules sanity test - if the ``check_mode`` attribute is present, check that it coincides with the ``support_check_mode`` parameter of ``AnsibleModule`` (https://github.com/ansible/ansible/pull/80090)."
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_1
|
||||||
|
short_description: Test for check mode attribute 1
|
||||||
|
description: Test for check mode attribute 1.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# doc says full support, code says none
|
||||||
|
support: full
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=False)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_2
|
||||||
|
short_description: Test for check mode attribute 2
|
||||||
|
description: Test for check mode attribute 2.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# doc says partial support, code says none
|
||||||
|
support: partial
|
||||||
|
details: Whatever this means.
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=False)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_3
|
||||||
|
short_description: Test for check mode attribute 3
|
||||||
|
description: Test for check mode attribute 3.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# doc says no support, code says some
|
||||||
|
support: none
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=True)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_4
|
||||||
|
short_description: Test for check mode attribute 4
|
||||||
|
description: Test for check mode attribute 4.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# documentation says some support, but no details
|
||||||
|
support: partial
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=True)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_5
|
||||||
|
short_description: Test for check mode attribute 5
|
||||||
|
description: Test for check mode attribute 5.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# Everything is correct: both docs and code claim no support
|
||||||
|
support: none
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=False)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_6
|
||||||
|
short_description: Test for check mode attribute 6
|
||||||
|
description: Test for check mode attribute 6.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# Everything is correct: docs says partial support *with details*, code claims (at least some) support
|
||||||
|
support: partial
|
||||||
|
details: Some details.
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=True)
|
||||||
|
module.exit_json()
|
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
module: check_mode_attribute_7
|
||||||
|
short_description: Test for check mode attribute 7
|
||||||
|
description: Test for check mode attribute 7.
|
||||||
|
author:
|
||||||
|
- Ansible Core Team
|
||||||
|
extends_documentation_fragment:
|
||||||
|
- ansible.builtin.action_common_attributes
|
||||||
|
attributes:
|
||||||
|
check_mode:
|
||||||
|
# Everything is correct: docs says full support, code claims (at least some) support
|
||||||
|
support: full
|
||||||
|
diff_mode:
|
||||||
|
support: none
|
||||||
|
platform:
|
||||||
|
platforms: all
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''#'''
|
||||||
|
RETURN = ''''''
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
module = AnsibleModule(argument_spec=dict(), supports_check_mode=True)
|
||||||
|
module.exit_json()
|
Loading…
Reference in New Issue