mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Try to parse RETURN as YAML
This commit is contained in:
parent
2218e763f8
commit
72690c89bd
1 changed files with 7 additions and 0 deletions
|
@ -7,6 +7,7 @@ import re
|
||||||
import abc
|
import abc
|
||||||
import ast
|
import ast
|
||||||
import sys
|
import sys
|
||||||
|
import yaml
|
||||||
import argparse
|
import argparse
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
@ -365,6 +366,12 @@ class ModuleValidator(Validator):
|
||||||
self.errors.append('No EXAMPLES provided')
|
self.errors.append('No EXAMPLES provided')
|
||||||
if not bool(ret):
|
if not bool(ret):
|
||||||
self.warnings.append('No RETURN provided')
|
self.warnings.append('No RETURN provided')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
yaml.safe_load(ret)
|
||||||
|
except:
|
||||||
|
self.errors.append('RETURN is not valid YAML')
|
||||||
|
self.traces.append(traceback.format_exc())
|
||||||
|
|
||||||
if self._python_module() and not self._just_docs():
|
if self._python_module() and not self._just_docs():
|
||||||
self._check_for_sys_exit()
|
self._check_for_sys_exit()
|
||||||
|
|
Loading…
Reference in a new issue