mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Add several new doc<->arg_spec checks (#36247)
* Add several new doc<->arg_spec checks. See #18183 * Update ignore.txt for validate-modules
This commit is contained in:
parent
77fa41795e
commit
50adc5409b
4 changed files with 2958 additions and 7 deletions
|
@ -25,6 +25,7 @@ import yaml
|
|||
import yaml.reader
|
||||
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
|
||||
|
||||
class AnsibleTextIOWrapper(TextIOWrapper):
|
||||
|
@ -114,3 +115,24 @@ def parse_yaml(value, lineno, module, name, load_all=False):
|
|||
})
|
||||
|
||||
return data, errors, traces
|
||||
|
||||
|
||||
def maybe_convert_bool(value):
|
||||
"""Safe conversion to boolean, catching TypeError and returning the original result
|
||||
|
||||
Only used in doc<->arg_spec comparisons
|
||||
"""
|
||||
try:
|
||||
return boolean(value)
|
||||
except TypeError:
|
||||
return value
|
||||
|
||||
|
||||
def compare_unordered_lists(a, b):
|
||||
"""Safe list comparisons
|
||||
|
||||
Supports:
|
||||
- unordered lists
|
||||
- unhashable elements
|
||||
"""
|
||||
return len(a) == len(b) and all(x in b for x in a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue