diff --git a/changelogs/fragments/65-private.yml b/changelogs/fragments/65-private.yml new file mode 100644 index 00000000..2e692722 --- /dev/null +++ b/changelogs/fragments/65-private.yml @@ -0,0 +1,2 @@ +minor_changes: + - "Supports hiding private plugins (https://github.com/ansible-community/antsibull-docs/pull/65)." diff --git a/src/antsibull_docs/data/docsite/list_of_plugins.rst.j2 b/src/antsibull_docs/data/docsite/list_of_plugins.rst.j2 index 0baeb83d..784b70ff 100644 --- a/src/antsibull_docs/data/docsite/list_of_plugins.rst.j2 +++ b/src/antsibull_docs/data/docsite/list_of_plugins.rst.j2 @@ -38,5 +38,5 @@ Index of all @{ plugin_type | capitalize }@ Plugins {% endfor %} {% else %} -No {% if plugin_type == 'module' %}module{% elif plugin_type == 'role' %}role{% else %}@{ plugin_type }@ plugin{% endif %} found. +No public {% if plugin_type == 'module' %}module{% elif plugin_type == 'role' %}role{% else %}@{ plugin_type }@ plugin{% endif %} found. {% endfor %} diff --git a/src/antsibull_docs/docs_parsing/__init__.py b/src/antsibull_docs/docs_parsing/__init__.py index 10d699d6..d22cdced 100644 --- a/src/antsibull_docs/docs_parsing/__init__.py +++ b/src/antsibull_docs/docs_parsing/__init__.py @@ -8,6 +8,7 @@ from __future__ import annotations import os +from collections.abc import Mapping from antsibull_core.venv import FakeVenvRunner, VenvRunner @@ -81,6 +82,7 @@ class AnsibleCollectionMetadata: path: str version: str | None requires_ansible: str | None + private_plugins: Mapping[str, list[str]] # mapping plugin_type to FQCNs docs_config: CollectionConfig def __init__( @@ -89,10 +91,12 @@ def __init__( docs_config: CollectionConfig, version: str | None = None, requires_ansible: str | None = None, + private_plugins: Mapping[str, list[str]] | None = None, ): self.path = path self.version = version self.requires_ansible = requires_ansible + self.private_plugins = private_plugins or {} self.docs_config = docs_config def __repr__(self): diff --git a/src/antsibull_docs/docs_parsing/routing.py b/src/antsibull_docs/docs_parsing/routing.py index 8bc9006a..b0c2215e 100644 --- a/src/antsibull_docs/docs_parsing/routing.py +++ b/src/antsibull_docs/docs_parsing/routing.py @@ -264,18 +264,24 @@ async def load_collection_routing( collection_name: str, collection_metadata: AnsibleCollectionMetadata ) -> dict[str, dict[str, dict[str, t.Any]]]: """ - Load plugin routing for a collection. + Load plugin routing for a collection, and populate the private plugins lists + in collection metadata. """ meta_runtime = load_meta_runtime(collection_name, collection_metadata) plugin_routing_out: dict[str, dict[str, dict[str, t.Any]]] = {} plugin_routing_in = meta_runtime.get("plugin_routing") or {} + private_plugins: dict[str, list[str]] = {} + collection_metadata.private_plugins = private_plugins for plugin_type in DOCUMENTABLE_PLUGINS: plugin_type_id = "modules" if plugin_type == "module" else plugin_type plugin_type_routing = plugin_routing_in.get(plugin_type_id) or {} - plugin_routing_out[plugin_type] = { - f"{collection_name}.{plugin_name}": process_dates(plugin_record) - for plugin_name, plugin_record in plugin_type_routing.items() - } + plugin_routing_out[plugin_type] = {} + private_plugins[plugin_type] = [] + for plugin_name, plugin_record in plugin_type_routing.items(): + fqcn = f"{collection_name}.{plugin_name}" + plugin_routing_out[plugin_type][fqcn] = process_dates(plugin_record) + if plugin_record.get("private", False): + private_plugins[plugin_type].append(plugin_name) if collection_name == "ansible.builtin": # ansible-core has a special directory structure we currently do not want diff --git a/src/antsibull_docs/write_docs/collections.py b/src/antsibull_docs/write_docs/collections.py index 096e532d..501287ae 100644 --- a/src/antsibull_docs/write_docs/collections.py +++ b/src/antsibull_docs/write_docs/collections.py @@ -98,11 +98,22 @@ async def write_plugin_lists( "Cannot parse required_ansible specifier set for {collection_name}", collection_name=collection_name, ) + + public_plugin_maps: dict[str, Mapping[str, str]] = {} + for plugin_type, plugin_data in plugin_maps.items(): + private_plugins = collection_meta.private_plugins.get(plugin_type) or [] + public_plugin_data = {} + for plugin_name, plugin_info in plugin_data.items(): + if plugin_name not in private_plugins: + public_plugin_data[plugin_name] = plugin_info + if public_plugin_data: + public_plugin_maps[plugin_type] = public_plugin_data + index_contents = _render_template( template, dest_dir, collection_name=collection_name, - plugin_maps=plugin_maps, + plugin_maps=public_plugin_maps, collection_version=collection_meta.version, requires_ansible=requires_ansible, link_data=link_data, diff --git a/src/antsibull_docs/write_docs/indexes.py b/src/antsibull_docs/write_docs/indexes.py index 4ed93382..8e58662e 100644 --- a/src/antsibull_docs/write_docs/indexes.py +++ b/src/antsibull_docs/write_docs/indexes.py @@ -59,7 +59,6 @@ async def write_callback_type_index( async def write_plugin_type_index( plugin_type: str, per_collection_plugins: Mapping[str, Mapping[str, str]], - # pylint:disable-next=unused-argument collection_metadata: Mapping[str, AnsibleCollectionMetadata], template: Template, dest_filename: str, @@ -77,11 +76,22 @@ async def write_plugin_type_index( :kwarg for_official_docsite: Default False. Set to True to use wording specific for the official docsite on docs.ansible.com. """ + public_per_collection_plugins = {} + for collection_name, plugins in per_collection_plugins.items(): + public_plugins = {} + collection_meta = collection_metadata[collection_name] + private_plugins = collection_meta.private_plugins.get(plugin_type) or [] + for plugin_name, plugin_data in plugins.items(): + if plugin_name not in private_plugins: + public_plugins[plugin_name] = plugin_data + if public_plugins: + public_per_collection_plugins[collection_name] = public_plugins + index_contents = _render_template( template, dest_filename, plugin_type=plugin_type, - per_collection_plugins=per_collection_plugins, + per_collection_plugins=public_per_collection_plugins, for_official_docsite=for_official_docsite, ) diff --git a/tests/functional/ansible-doc-cache-all.json b/tests/functional/ansible-doc-cache-all.json index 42c1c38b..52124640 100644 --- a/tests/functional/ansible-doc-cache-all.json +++ b/tests/functional/ansible-doc-cache-all.json @@ -1008,6 +1008,39 @@ } }, "lookup": { + "ns2.col.bar": { + "doc": { + "author": "Felix Fontein (@felixfontein)", + "collection": "ns2.col", + "description": [ + "This one is private." + ], + "filename": "ansible_collections/ns2/col/plugins/lookup/bar.py", + "name": "bar", + "options": { + "_terms": { + "description": "Something", + "elements": "dict", + "required": true, + "type": "list" + } + }, + "short_description": "Look up some bar", + "version_added": "1.0.0", + "version_added_collection": "ns2.col" + }, + "examples": "\n- name: Look up!\n ansible.builtin.debug:\n msg: \"{{ lookup('ns2.col.bar', {}) }}\"\n", + "metadata": null, + "return": { + "_raw": { + "description": [ + "The resulting stuff." + ], + "elements": "dict", + "type": "list" + } + } + }, "ns2.col.foo": { "doc": { "author": "Felix Fontein (@felixfontein)", diff --git a/tests/functional/ansible-doc-cache-ns2.col.json b/tests/functional/ansible-doc-cache-ns2.col.json index c3253afd..c22f16a3 100644 --- a/tests/functional/ansible-doc-cache-ns2.col.json +++ b/tests/functional/ansible-doc-cache-ns2.col.json @@ -1008,6 +1008,39 @@ } }, "lookup": { + "ns2.col.bar": { + "doc": { + "author": "Felix Fontein (@felixfontein)", + "collection": "ns2.col", + "description": [ + "This one is private." + ], + "filename": "ansible_collections/ns2/col/plugins/lookup/bar.py", + "name": "bar", + "options": { + "_terms": { + "description": "Something", + "elements": "dict", + "required": true, + "type": "list" + } + }, + "short_description": "Look up some bar", + "version_added": "1.0.0", + "version_added_collection": "ns2.col" + }, + "examples": "\n- name: Look up!\n ansible.builtin.debug:\n msg: \"{{ lookup('ns2.col.bar', {}) }}\"\n", + "metadata": null, + "return": { + "_raw": { + "description": [ + "The resulting stuff." + ], + "elements": "dict", + "type": "list" + } + } + }, "ns2.col.foo": { "doc": { "author": "Felix Fontein (@felixfontein)", diff --git a/tests/functional/baseline-default/collections/ns2/col/bar_lookup.rst b/tests/functional/baseline-default/collections/ns2/col/bar_lookup.rst new file mode 100644 index 00000000..c84defbd --- /dev/null +++ b/tests/functional/baseline-default/collections/ns2/col/bar_lookup.rst @@ -0,0 +1,253 @@ + +.. Document meta + +:orphan: +:github_url: https://github.com/ansible-community/antsibull-docs/edit/main/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. role:: ansible-attribute-support-label +.. role:: ansible-attribute-support-property +.. role:: ansible-attribute-support-full +.. role:: ansible-attribute-support-partial +.. role:: ansible-attribute-support-none +.. role:: ansible-attribute-support-na +.. role:: ansible-option-type +.. role:: ansible-option-elements +.. role:: ansible-option-required +.. role:: ansible-option-versionadded +.. role:: ansible-option-aliases +.. role:: ansible-option-choices +.. role:: ansible-option-choices-default-mark +.. role:: ansible-option-default-bold +.. role:: ansible-option-configuration +.. role:: ansible-option-returned-bold +.. role:: ansible-option-sample-bold + +.. Anchors + +.. _ansible_collections.ns2.col.bar_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +ns2.col.bar lookup -- Look up some bar +++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This lookup plugin is part of the `ns2.col collection `_ (version 2.1.0). + + To install it, use: :code:`ansible-galaxy collection install ns2.col`. + + To use it in a playbook, specify: :code:`ns2.col.bar`. + +.. version_added + +.. rst-class:: ansible-version-added + +New in ns2.col 1.0.0 + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- This one is private. + + +.. Aliases + + +.. Requirements + + + + +.. Terms + +Terms +----- + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Parameter + - Comments + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__parameter-_terms: + + .. rst-class:: ansible-option-title + + **Terms** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` / :ansible-option-required:`required` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Something + + + .. raw:: html + +
+ + + + + +.. Options + + +.. Attributes + + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" + + + + +.. Facts + + +.. Return values + +Return Value +------------ + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Key + - Description + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__return-_raw: + + .. rst-class:: ansible-option-title + + **Return value** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The resulting stuff. + + + .. rst-class:: ansible-option-line + + :ansible-option-returned-bold:`Returned:` success + + + .. raw:: html + +
+ + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Felix Fontein (@felixfontein) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. raw:: html + + + +.. Parsing errors + diff --git a/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/bar_lookup.rst b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/bar_lookup.rst new file mode 100644 index 00000000..c84defbd --- /dev/null +++ b/tests/functional/baseline-no-breadcrumbs/collections/ns2/col/bar_lookup.rst @@ -0,0 +1,253 @@ + +.. Document meta + +:orphan: +:github_url: https://github.com/ansible-community/antsibull-docs/edit/main/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. role:: ansible-attribute-support-label +.. role:: ansible-attribute-support-property +.. role:: ansible-attribute-support-full +.. role:: ansible-attribute-support-partial +.. role:: ansible-attribute-support-none +.. role:: ansible-attribute-support-na +.. role:: ansible-option-type +.. role:: ansible-option-elements +.. role:: ansible-option-required +.. role:: ansible-option-versionadded +.. role:: ansible-option-aliases +.. role:: ansible-option-choices +.. role:: ansible-option-choices-default-mark +.. role:: ansible-option-default-bold +.. role:: ansible-option-configuration +.. role:: ansible-option-returned-bold +.. role:: ansible-option-sample-bold + +.. Anchors + +.. _ansible_collections.ns2.col.bar_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +ns2.col.bar lookup -- Look up some bar +++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This lookup plugin is part of the `ns2.col collection `_ (version 2.1.0). + + To install it, use: :code:`ansible-galaxy collection install ns2.col`. + + To use it in a playbook, specify: :code:`ns2.col.bar`. + +.. version_added + +.. rst-class:: ansible-version-added + +New in ns2.col 1.0.0 + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- This one is private. + + +.. Aliases + + +.. Requirements + + + + +.. Terms + +Terms +----- + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Parameter + - Comments + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__parameter-_terms: + + .. rst-class:: ansible-option-title + + **Terms** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` / :ansible-option-required:`required` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Something + + + .. raw:: html + +
+ + + + + +.. Options + + +.. Attributes + + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" + + + + +.. Facts + + +.. Return values + +Return Value +------------ + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Key + - Description + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__return-_raw: + + .. rst-class:: ansible-option-title + + **Return value** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The resulting stuff. + + + .. rst-class:: ansible-option-line + + :ansible-option-returned-bold:`Returned:` success + + + .. raw:: html + +
+ + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Felix Fontein (@felixfontein) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. raw:: html + + + +.. Parsing errors + diff --git a/tests/functional/baseline-no-indexes/collections/ns2/col/bar_lookup.rst b/tests/functional/baseline-no-indexes/collections/ns2/col/bar_lookup.rst new file mode 100644 index 00000000..c84defbd --- /dev/null +++ b/tests/functional/baseline-no-indexes/collections/ns2/col/bar_lookup.rst @@ -0,0 +1,253 @@ + +.. Document meta + +:orphan: +:github_url: https://github.com/ansible-community/antsibull-docs/edit/main/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. role:: ansible-attribute-support-label +.. role:: ansible-attribute-support-property +.. role:: ansible-attribute-support-full +.. role:: ansible-attribute-support-partial +.. role:: ansible-attribute-support-none +.. role:: ansible-attribute-support-na +.. role:: ansible-option-type +.. role:: ansible-option-elements +.. role:: ansible-option-required +.. role:: ansible-option-versionadded +.. role:: ansible-option-aliases +.. role:: ansible-option-choices +.. role:: ansible-option-choices-default-mark +.. role:: ansible-option-default-bold +.. role:: ansible-option-configuration +.. role:: ansible-option-returned-bold +.. role:: ansible-option-sample-bold + +.. Anchors + +.. _ansible_collections.ns2.col.bar_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +ns2.col.bar lookup -- Look up some bar +++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This lookup plugin is part of the `ns2.col collection `_ (version 2.1.0). + + To install it, use: :code:`ansible-galaxy collection install ns2.col`. + + To use it in a playbook, specify: :code:`ns2.col.bar`. + +.. version_added + +.. rst-class:: ansible-version-added + +New in ns2.col 1.0.0 + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- This one is private. + + +.. Aliases + + +.. Requirements + + + + +.. Terms + +Terms +----- + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Parameter + - Comments + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__parameter-_terms: + + .. rst-class:: ansible-option-title + + **Terms** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` / :ansible-option-required:`required` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Something + + + .. raw:: html + +
+ + + + + +.. Options + + +.. Attributes + + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" + + + + +.. Facts + + +.. Return values + +Return Value +------------ + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Key + - Description + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__return-_raw: + + .. rst-class:: ansible-option-title + + **Return value** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The resulting stuff. + + + .. rst-class:: ansible-option-line + + :ansible-option-returned-bold:`Returned:` success + + + .. raw:: html + +
+ + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Felix Fontein (@felixfontein) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. raw:: html + + + +.. Parsing errors + diff --git a/tests/functional/baseline-squash-hierarchy/bar_lookup.rst b/tests/functional/baseline-squash-hierarchy/bar_lookup.rst new file mode 100644 index 00000000..c84defbd --- /dev/null +++ b/tests/functional/baseline-squash-hierarchy/bar_lookup.rst @@ -0,0 +1,253 @@ + +.. Document meta + +:orphan: +:github_url: https://github.com/ansible-community/antsibull-docs/edit/main/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. role:: ansible-attribute-support-label +.. role:: ansible-attribute-support-property +.. role:: ansible-attribute-support-full +.. role:: ansible-attribute-support-partial +.. role:: ansible-attribute-support-none +.. role:: ansible-attribute-support-na +.. role:: ansible-option-type +.. role:: ansible-option-elements +.. role:: ansible-option-required +.. role:: ansible-option-versionadded +.. role:: ansible-option-aliases +.. role:: ansible-option-choices +.. role:: ansible-option-choices-default-mark +.. role:: ansible-option-default-bold +.. role:: ansible-option-configuration +.. role:: ansible-option-returned-bold +.. role:: ansible-option-sample-bold + +.. Anchors + +.. _ansible_collections.ns2.col.bar_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +ns2.col.bar lookup -- Look up some bar +++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This lookup plugin is part of the `ns2.col collection `_ (version 2.1.0). + + To install it, use: :code:`ansible-galaxy collection install ns2.col`. + + To use it in a playbook, specify: :code:`ns2.col.bar`. + +.. version_added + +.. rst-class:: ansible-version-added + +New in ns2.col 1.0.0 + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- This one is private. + + +.. Aliases + + +.. Requirements + + + + +.. Terms + +Terms +----- + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Parameter + - Comments + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__parameter-_terms: + + .. rst-class:: ansible-option-title + + **Terms** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` / :ansible-option-required:`required` + + + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Something + + + .. raw:: html + +
+ + + + + +.. Options + + +.. Attributes + + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" + + + + +.. Facts + + +.. Return values + +Return Value +------------ + +.. rst-class:: ansible-option-table + +.. list-table:: + :width: 100% + :widths: auto + :header-rows: 1 + + * - Key + - Description + + * - .. raw:: html + +
+
+ + .. _ansible_collections.ns2.col.bar_lookup__return-_raw: + + .. rst-class:: ansible-option-title + + **Return value** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary` + + .. raw:: html + +
+ + - .. raw:: html + +
+ + The resulting stuff. + + + .. rst-class:: ansible-option-line + + :ansible-option-returned-bold:`Returned:` success + + + .. raw:: html + +
+ + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Felix Fontein (@felixfontein) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. raw:: html + + + +.. Parsing errors + diff --git a/tests/functional/baseline-use-html-blobs/collections/ns2/col/bar_lookup.rst b/tests/functional/baseline-use-html-blobs/collections/ns2/col/bar_lookup.rst new file mode 100644 index 00000000..407fefd1 --- /dev/null +++ b/tests/functional/baseline-use-html-blobs/collections/ns2/col/bar_lookup.rst @@ -0,0 +1,215 @@ + +.. Document meta + +:orphan: +:github_url: https://github.com/ansible-community/antsibull-docs/edit/main/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr + +.. |antsibull-internal-nbsp| unicode:: 0xA0 + :trim: + +.. role:: ansible-attribute-support-label +.. role:: ansible-attribute-support-property +.. role:: ansible-attribute-support-full +.. role:: ansible-attribute-support-partial +.. role:: ansible-attribute-support-none +.. role:: ansible-attribute-support-na +.. role:: ansible-option-type +.. role:: ansible-option-elements +.. role:: ansible-option-required +.. role:: ansible-option-versionadded +.. role:: ansible-option-aliases +.. role:: ansible-option-choices +.. role:: ansible-option-choices-default-mark +.. role:: ansible-option-default-bold +.. role:: ansible-option-configuration +.. role:: ansible-option-returned-bold +.. role:: ansible-option-sample-bold + +.. Anchors + +.. _ansible_collections.ns2.col.bar_lookup: + +.. Anchors: short name for ansible.builtin + +.. Anchors: aliases + + + +.. Title + +ns2.col.bar lookup -- Look up some bar +++++++++++++++++++++++++++++++++++++++ + +.. Collection note + +.. note:: + This lookup plugin is part of the `ns2.col collection `_ (version 2.1.0). + + To install it, use: :code:`ansible-galaxy collection install ns2.col`. + + To use it in a playbook, specify: :code:`ns2.col.bar`. + +.. version_added + +.. rst-class:: ansible-version-added + +New in ns2.col 1.0.0 + +.. contents:: + :local: + :depth: 1 + +.. Deprecated + + +Synopsis +-------- + +.. Description + +- This one is private. + + +.. Aliases + + +.. Requirements + + + + +.. Terms + +Terms +----- + +.. raw:: html + + + + + + + + + + + + + + +

Parameter

Comments

+
+

Terms

+ +

+ list + / elements=dictionary + / required +

+ +
+

Something

+
+ + + + + + +.. Options + + +.. Attributes + + +.. Notes + + +.. Seealso + + +.. Examples + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" + + + + +.. Facts + + +.. Return values + +Return Value +------------ + +.. raw:: html + + + + + + + + + + + + + + +

Key

Description

+
+

Return value

+ +

+ list + / elements=dictionary +

+
+

The resulting stuff.

+

Returned: success

+
+ + + +.. Status (Presently only deprecated) + + +.. Authors + +Authors +~~~~~~~ + +- Felix Fontein (@felixfontein) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. + +.. Extra links + +Collection links +~~~~~~~~~~~~~~~~ + +.. raw:: html + + + +.. Parsing errors + diff --git a/tests/functional/collections/ansible_collections/ns2/col/meta/runtime.yml b/tests/functional/collections/ansible_collections/ns2/col/meta/runtime.yml index 313fcac4..529e42b5 100644 --- a/tests/functional/collections/ansible_collections/ns2/col/meta/runtime.yml +++ b/tests/functional/collections/ansible_collections/ns2/col/meta/runtime.yml @@ -11,3 +11,8 @@ action_groups: - foo2 bar_group: - foo2 + +plugin_routing: + lookup: + bar: + private: true diff --git a/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py b/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py new file mode 100644 index 00000000..c1cc0565 --- /dev/null +++ b/tests/functional/collections/ansible_collections/ns2/col/plugins/lookup/bar.py @@ -0,0 +1,44 @@ +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: Ansible Project + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ + name: bar + author: Felix Fontein (@felixfontein) + version_added: "1.0.0" + short_description: Look up some bar + description: + - This one is private. + options: + _terms: + description: Something + required: true + type: list + elements: dict +""" + +EXAMPLES = """ +- name: Look up! + ansible.builtin.debug: + msg: "{{ lookup('ns2.col.bar', {}) }}" +""" + +RETURN = """ +_raw: + description: + - The resulting stuff. + type: list + elements: dict +""" + +from ansible.plugins.lookup import LookupBase + + +class LookupModule(LookupBase): + def run(self, terms, variables=None, **kwargs): + self.set_options(var_options=variables, direct=kwargs) + return terms