summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fontein <felix@fontein.de>2025-01-13 23:24:09 +0100
committerGitHub <noreply@github.com>2025-01-13 23:24:09 +0100
commitae55f874a09730589bf697fda411de42d36916ec (patch)
tree1da493febfedf332cc3fb7be3865caddc1e4bcf9
parentUpdate ticketing stubs (#84535) (diff)
downloadansible-ae55f874a09730589bf697fda411de42d36916ec.tar.xz
ansible-ae55f874a09730589bf697fda411de42d36916ec.zip
Enforce FQCNs in seealso plugin/module entries. (#84325)
-rw-r--r--changelogs/fragments/84325-validate-modules-seealso-fqcn.yml2
-rw-r--r--test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py15
2 files changed, 15 insertions, 2 deletions
diff --git a/changelogs/fragments/84325-validate-modules-seealso-fqcn.yml b/changelogs/fragments/84325-validate-modules-seealso-fqcn.yml
new file mode 100644
index 0000000000..98bb102fb9
--- /dev/null
+++ b/changelogs/fragments/84325-validate-modules-seealso-fqcn.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - "validate-modules sanity test - make sure that ``module`` and ``plugin`` ``seealso`` entries use FQCNs (https://github.com/ansible/ansible/pull/84325)."
diff --git a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py
index d44553e64a..abbbd66c25 100644
--- a/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py
+++ b/test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py
@@ -67,6 +67,17 @@ def collection_name(v, error_code=None):
return v
+def fqcn(v, error_code=None):
+ if not isinstance(v, string_types):
+ raise _add_ansible_error_code(
+ Invalid('Module/plugin name must be a string'), error_code or 'invalid-documentation')
+ m = FULLY_QUALIFIED_COLLECTION_RESOURCE_RE.match(v)
+ if not m:
+ raise _add_ansible_error_code(
+ Invalid('Module/plugin name must be of format `<namespace>.<collection>.<name>(.<subname>)*`'), error_code or 'invalid-documentation')
+ return v
+
+
def deprecation_versions():
"""Create a list of valid version for deprecation entries, current+4"""
major, minor = [int(version) for version in __version__.split('.')[0:2]]
@@ -196,11 +207,11 @@ seealso_schema = Schema(
[
Any(
{
- Required('module'): Any(*string_types),
+ Required('module'): fqcn,
'description': doc_string,
},
{
- Required('plugin'): Any(*string_types),
+ Required('plugin'): fqcn,
Required('plugin_type'): Any(*DOCUMENTABLE_PLUGINS),
'description': doc_string,
},