Try to parse RETURN as YAML

This commit is contained in:
Matt Martz 2015-11-24 10:25:57 -06:00 committed by John Barker
parent 2218e763f8
commit 72690c89bd

View file

@ -7,6 +7,7 @@ import re
import abc
import ast
import sys
import yaml
import argparse
import traceback
@ -365,6 +366,12 @@ class ModuleValidator(Validator):
self.errors.append('No EXAMPLES provided')
if not bool(ret):
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():
self._check_for_sys_exit()