From d777e217e7ec6fcec2e2e108a858dd1260f2c1e0 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Sat, 21 May 2016 10:51:29 -0500 Subject: [PATCH] Issues with pre-existing docs should not cause errors, only warnings --- ansible_testing/modules.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 38b4167bff6..707387f0231 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -72,6 +72,7 @@ class Validator(object): self.errors = [] self.warnings = [] self.traces = [] + self.warning_traces = [] @abc.abstractproperty def object_name(self): @@ -98,7 +99,11 @@ class Validator(object): ret = [] - for trace in self.traces: + traces = self.traces[:] + if warnings and self.warnings: + traces.extend(self.warning_traces) + + for trace in traces: print('TRACE:') print('\n '.join((' %s' % trace).splitlines())) for error in self.errors: @@ -225,7 +230,6 @@ class ModuleValidator(Validator): elif not new_only: self.errors.append(msg) - def _find_module_utils(self, main): linenos = [] found_basic = False @@ -468,13 +472,14 @@ class ModuleValidator(Validator): existing_options = existing_doc.get('options', {}) except AssertionError: fragment = doc['extends_documentation_fragment'] - self.errors.append('Existing DOCUMENTATION fragment missing: ' - '%s' % fragment) + self.warnings.append('Pre-existing DOCUMENTATION fragment ' + 'missing: %s' % fragment) return except Exception as e: - self.traces.append(e) - self.errors.append('Unknown existing DOCUMENTATION error, see ' - 'TRACE') + self.warning_traces.append(e) + self.warnings.append('Unknown pre-existing DOCUMENTATION ' + 'error, see TRACE. Submodule refs may ' + 'need updated') return try: