Fix module validator handling of empty options.
This commit is contained in:
parent
c6b3815bf0
commit
90ac38bd4c
2 changed files with 6 additions and 6 deletions
|
@ -104,6 +104,7 @@ Errors
|
||||||
Arguments with a default should not be marked as required
|
Arguments with a default should not be marked as required
|
||||||
318 Module deprecated, but DOCUMENTATION.deprecated is missing
|
318 Module deprecated, but DOCUMENTATION.deprecated is missing
|
||||||
319 ``RETURN`` fragments missing or invalid
|
319 ``RETURN`` fragments missing or invalid
|
||||||
|
320 ``DOCUMENTATION.options`` must be a dictionary/hash when used
|
||||||
..
|
..
|
||||||
--------- -------------------
|
--------- -------------------
|
||||||
**4xx** **Syntax**
|
**4xx** **Syntax**
|
||||||
|
|
|
@ -814,12 +814,11 @@ class ModuleValidator(Validator):
|
||||||
msg='Unknown DOCUMENTATION error, see TRACE'
|
msg='Unknown DOCUMENTATION error, see TRACE'
|
||||||
)
|
)
|
||||||
|
|
||||||
if 'options' in doc and doc['options'] is None and doc.get('extends_documentation_fragment'):
|
if 'options' in doc and doc['options'] is None:
|
||||||
self.reporter.error(
|
self.reporter.error(
|
||||||
path=self.object_path,
|
path=self.object_path,
|
||||||
code=304,
|
code=320,
|
||||||
msg=('DOCUMENTATION.options must be a dictionary/hash when used '
|
msg='DOCUMENTATION.options must be a dictionary/hash when used',
|
||||||
'with DOCUMENTATION.extends_documentation_fragment')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.object_name.startswith('_') and not os.path.islink(self.object_path):
|
if self.object_name.startswith('_') and not os.path.islink(self.object_path):
|
||||||
|
@ -980,7 +979,7 @@ class ModuleValidator(Validator):
|
||||||
with CaptureStd():
|
with CaptureStd():
|
||||||
try:
|
try:
|
||||||
existing_doc, _, _, _ = get_docstring(self.base_module, verbose=True)
|
existing_doc, _, _, _ = get_docstring(self.base_module, verbose=True)
|
||||||
existing_options = existing_doc.get('options', {})
|
existing_options = existing_doc.get('options', {}) or {}
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
fragment = doc['extends_documentation_fragment']
|
fragment = doc['extends_documentation_fragment']
|
||||||
self.reporter.warning(
|
self.reporter.warning(
|
||||||
|
@ -1010,7 +1009,7 @@ class ModuleValidator(Validator):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
mod_version_added = StrictVersion('0.0')
|
mod_version_added = StrictVersion('0.0')
|
||||||
|
|
||||||
options = doc.get('options', {})
|
options = doc.get('options', {}) or {}
|
||||||
|
|
||||||
should_be = '.'.join(ansible_version.split('.')[:2])
|
should_be = '.'.join(ansible_version.split('.')[:2])
|
||||||
strict_ansible_version = StrictVersion(should_be)
|
strict_ansible_version = StrictVersion(should_be)
|
||||||
|
|
Loading…
Reference in a new issue