Fix validate-modules version_added test (#78554)

pull/78645/head
Sloane Hertel 2 years ago committed by GitHub
parent 843405077e
commit 12cec69545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- validate-modules - fix validating version_added for new options.

@ -439,6 +439,7 @@ class ModuleValidator(Validator):
def _get_base_file(self):
# In case of module moves, look for the original location
base_path = self._get_base_branch_module_path()
ext = os.path.splitext(base_path or self.path)[1]
command = ['git', 'show', '%s:%s' % (self.base_branch, base_path or self.path)]
p = subprocess.run(command, stdin=subprocess.DEVNULL, capture_output=True, check=False)
@ -446,7 +447,7 @@ class ModuleValidator(Validator):
if int(p.returncode) != 0:
return None
t = tempfile.NamedTemporaryFile(delete=False)
t = tempfile.NamedTemporaryFile(delete=False, suffix=ext)
t.write(p.stdout)
t.close()
@ -2097,7 +2098,8 @@ class ModuleValidator(Validator):
# already reported during schema validation
continue
if collection_name != self.collection_name:
builtin = self.collection_name == 'ansible.builtin' and collection_name in ('ansible.builtin', None)
if not builtin and collection_name != self.collection_name:
continue
if (strict_ansible_version != mod_version_added and
(version_added < strict_ansible_version or

Loading…
Cancel
Save