From 72690c89bdb8a2d73541249f623a48f1d46366eb Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 24 Nov 2015 10:25:57 -0600 Subject: [PATCH] Try to parse RETURN as YAML --- ansible_testing/modules.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 34d409d63a..033eadc4d8 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -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()