mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-13 07:25:10 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = """
|
||||
name: a_module
|
||||
short_description: Test whether a given string refers to an existing module or action plugin
|
||||
version_added: 4.0.0
|
||||
|
|
@ -17,9 +17,9 @@ options:
|
|||
description: A string denoting a fully qualified collection name (FQCN) of a module or action plugin.
|
||||
type: string
|
||||
required: true
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = """
|
||||
- name: Make sure that community.aws.route53 is available
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
|
|
@ -30,13 +30,13 @@ EXAMPLES = '''
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'community.general.does_not_exist' is not community.general.a_module"
|
||||
'''
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
RETURN = """
|
||||
_value:
|
||||
description: Whether the module or action plugin denoted by the input exists.
|
||||
type: boolean
|
||||
'''
|
||||
"""
|
||||
|
||||
from ansible.plugins.loader import action_loader, module_loader
|
||||
|
||||
|
|
@ -63,9 +63,9 @@ def a_module(term):
|
|||
|
||||
|
||||
class TestModule:
|
||||
''' Ansible jinja2 tests '''
|
||||
"""Ansible jinja2 tests"""
|
||||
|
||||
def tests(self):
|
||||
return {
|
||||
'a_module': a_module,
|
||||
"a_module": a_module,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = """
|
||||
name: ansible_type
|
||||
short_description: Validate input type
|
||||
version_added: "9.2.0"
|
||||
|
|
@ -23,9 +23,9 @@ options:
|
|||
description: Data type aliases.
|
||||
default: {}
|
||||
type: dictionary
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = """
|
||||
# Substitution converts str to AnsibleUnicode or _AnsibleTaggedStr
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
|
@ -214,13 +214,13 @@ dtype: number
|
|||
data: 123.45
|
||||
result: '{{ data is community.general.ansible_type(dtype, alias) }}'
|
||||
# result => true
|
||||
'''
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
RETURN = """
|
||||
_value:
|
||||
description: Whether the data type is valid.
|
||||
type: bool
|
||||
'''
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
|
@ -245,8 +245,5 @@ def ansible_type(data, dtype, alias=None):
|
|||
|
||||
|
||||
class TestModule:
|
||||
|
||||
def tests(self):
|
||||
return {
|
||||
'ansible_type': ansible_type
|
||||
}
|
||||
return {"ansible_type": ansible_type}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = """
|
||||
name: fqdn_valid
|
||||
short_description: Validates fully-qualified domain names against RFC 1123
|
||||
version_added: 8.1.0
|
||||
|
|
@ -41,9 +41,9 @@ options:
|
|||
default: false
|
||||
type: bool
|
||||
required: false
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = """
|
||||
- name: Make sure that hostname is valid
|
||||
ansible.builtin.assert:
|
||||
that: hostname is community.general.fqdn_valid
|
||||
|
|
@ -55,13 +55,13 @@ EXAMPLES = '''
|
|||
- name: Make sure that hostname is at least 2 labels long (a.b). Allow '_'
|
||||
ansible.builtin.assert:
|
||||
that: hostname is community.general.fqdn_valid(min_labels=2, allow_underscores=True)
|
||||
'''
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
RETURN = """
|
||||
_value:
|
||||
description: Whether the name is valid.
|
||||
type: bool
|
||||
'''
|
||||
"""
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
|
||||
|
|
@ -82,18 +82,18 @@ def fqdn_valid(name, min_labels=1, allow_underscores=False):
|
|||
"""
|
||||
|
||||
if ANOTHER_LIBRARY_IMPORT_ERROR:
|
||||
raise AnsibleError('Python package fqdn must be installed to use this test.') from ANOTHER_LIBRARY_IMPORT_ERROR
|
||||
raise AnsibleError("Python package fqdn must be installed to use this test.") from ANOTHER_LIBRARY_IMPORT_ERROR
|
||||
|
||||
fobj = FQDN(name, min_labels=min_labels, allow_underscores=allow_underscores)
|
||||
return (fobj.is_valid)
|
||||
return fobj.is_valid
|
||||
|
||||
|
||||
class TestModule:
|
||||
''' Ansible test hostname validity.
|
||||
https://pypi.org/project/fqdn/
|
||||
'''
|
||||
"""Ansible test hostname validity.
|
||||
https://pypi.org/project/fqdn/
|
||||
"""
|
||||
|
||||
def tests(self):
|
||||
return {
|
||||
'fqdn_valid': fqdn_valid,
|
||||
"fqdn_valid": fqdn_valid,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue