Skip to content

Commit

Permalink
Adjust collection URLs for new Galaxy codebase (#220)
Browse files Browse the repository at this point in the history
* Move defaults for collection URL transform and collection install command to once place.

* Adjust default collection URLs.

* Lint and update tests.
  • Loading branch information
felixfontein authored Sep 30, 2023
1 parent 8b126bf commit 02b450d
Show file tree
Hide file tree
Showing 172 changed files with 201 additions and 180 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/220-collection_url-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- "The default collection URL template has been changed from ``https://galaxy.ansible.com/{namespace}/{name}`` to ``https://galaxy.ansible.com/ui/repo/published/{namespace}/{name}/``
to adjust for the Galaxy codebase change on September 30th, 2023 (https://github.com/ansible-community/antsibull-docs/issues/147, https://github.com/ansible-community/antsibull-docs/pull/220)."
8 changes: 6 additions & 2 deletions src/antsibull_docs/cli/doc_commands/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
get_plugin_contents,
normalize_all_plugin_info,
)
from ...schemas.app_context import (
DEFAULT_COLLECTION_INSTALL_CMD,
DEFAULT_COLLECTION_URL_TRANSFORM,
)
from ...utils.collection_name_transformer import CollectionNameTransformer
from ...write_docs.collections import output_extra_docs, output_indexes
from ...write_docs.hierarchy import (
Expand Down Expand Up @@ -250,11 +254,11 @@ def generate_docs_for_all_collections( # noqa: C901
collection_namespaces = get_collection_namespaces(collection_to_plugin_info.keys())

collection_url = CollectionNameTransformer(
app_ctx.collection_url, "https://galaxy.ansible.com/{namespace}/{name}"
app_ctx.collection_url, DEFAULT_COLLECTION_URL_TRANSFORM
)
collection_install = CollectionNameTransformer(
app_ctx.collection_install,
"ansible-galaxy collection install {namespace}.{name}",
DEFAULT_COLLECTION_INSTALL_CMD,
)

filename_generator = FilenameGenerator(
Expand Down
12 changes: 8 additions & 4 deletions src/antsibull_docs/cli/doc_commands/lint_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from ...jinja2.environment import OutputFormat
from ...lint_extra_docs import lint_collection_extra_docs_files
from ...lint_plugin_docs import lint_collection_plugin_docs, lint_core_plugin_docs
from ...schemas.app_context import (
DEFAULT_COLLECTION_INSTALL_CMD,
DEFAULT_COLLECTION_URL_TRANSFORM,
)
from ...utils.collection_name_transformer import CollectionNameTransformer

mlog = log.fields(mod=__name__)
Expand Down Expand Up @@ -55,11 +59,11 @@ def lint_collection_docs() -> int:
if plugin_docs:
flog.notice("Linting plugin docs")
collection_url = CollectionNameTransformer(
app_ctx.collection_url, "https://galaxy.ansible.com/{namespace}/{name}"
app_ctx.collection_url, DEFAULT_COLLECTION_URL_TRANSFORM
)
collection_install = CollectionNameTransformer(
app_ctx.collection_install,
"ansible-galaxy collection install {namespace}.{name}",
DEFAULT_COLLECTION_INSTALL_CMD,
)
errors.extend(
lint_collection_plugin_docs(
Expand Down Expand Up @@ -106,11 +110,11 @@ def lint_core_docs() -> int:

flog.notice("Linting plugin docs")
collection_url = CollectionNameTransformer(
app_ctx.collection_url, "https://galaxy.ansible.com/{namespace}/{name}"
app_ctx.collection_url, DEFAULT_COLLECTION_URL_TRANSFORM
)
collection_install = CollectionNameTransformer(
app_ctx.collection_install,
"ansible-galaxy collection install {namespace}.{name}",
DEFAULT_COLLECTION_INSTALL_CMD,
)
errors = lint_core_plugin_docs(
collection_url=collection_url,
Expand Down
8 changes: 6 additions & 2 deletions src/antsibull_docs/cli/doc_commands/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
from ...jinja2 import FilenameGenerator, OutputFormat
from ...jinja2.environment import doc_environment
from ...process_docs import normalize_plugin_info
from ...schemas.app_context import (
DEFAULT_COLLECTION_INSTALL_CMD,
DEFAULT_COLLECTION_URL_TRANSFORM,
)
from ...utils.collection_name_transformer import CollectionNameTransformer
from ...write_docs.plugins import write_plugin_rst

Expand Down Expand Up @@ -118,11 +122,11 @@ def generate_plugin_docs(

# Setup the jinja environment
collection_url = CollectionNameTransformer(
app_ctx.collection_url, "https://galaxy.ansible.com/{namespace}/{name}"
app_ctx.collection_url, DEFAULT_COLLECTION_URL_TRANSFORM
)
collection_install = CollectionNameTransformer(
app_ctx.collection_install,
"ansible-galaxy collection install {namespace}.{name}",
DEFAULT_COLLECTION_INSTALL_CMD,
)
env = doc_environment(
collection_url=collection_url,
Expand Down
10 changes: 8 additions & 2 deletions src/antsibull_docs/schemas/app_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
DOC_PARSING_BACKEND_CHOICES_F = p.Field("auto", regex="^(auto|ansible-core-2\\.13)$")


DEFAULT_COLLECTION_URL_TRANSFORM = (
"https://galaxy.ansible.com/ui/repo/published/{namespace}/{name}/"
)
DEFAULT_COLLECTION_INSTALL_CMD = "ansible-galaxy collection install {namespace}.{name}"


class DocsAppContext(CoreAppContext):
# These are already defined in CoreConfigModel, but deprecated and will be removed in
# antsibull-core 3.0.0
Expand All @@ -29,10 +35,10 @@ class DocsAppContext(CoreAppContext):
use_html_blobs: p.StrictBool = False

collection_url: dict[str, str] = {
"*": "https://galaxy.ansible.com/{namespace}/{name}",
"*": DEFAULT_COLLECTION_URL_TRANSFORM,
}
collection_install: dict[str, str] = {
"*": "ansible-galaxy collection install {namespace}.{name}",
"*": DEFAULT_COLLECTION_INSTALL_CMD,
}

# pylint: disable-next=unused-private-member
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ns.col2.bar role -- Bar role
.. Collection note
.. note::
This role is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This role is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns.col2.foo2 module -- Foo two
.. Collection note
.. note::
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns.col2.foo3 module -- Foo III
.. Collection note
.. note::
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down Expand Up @@ -423,7 +423,7 @@ Authors
.. Parsing errors
There were some errors parsing the documentation for this plugin. Please file a bug with the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_.
There were some errors parsing the documentation for this plugin. Please file a bug with the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_.

The errors were:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns.col2.foo4 module -- Markup reference linting test
.. Collection note
.. note::
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ The errors were:
extra fields not permitted (type=value_error.extra)


File a bug with the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ in order to have it corrected.
File a bug with the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ in order to have it corrected.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.bar filter -- The bar filter
.. Collection note
.. note::
This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.bar test -- Is something a bar
.. Collection note
.. note::
This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo2 module -- Another foo
.. Collection note
.. note::
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo become -- Use foo \ :ansopt:`ns2.col.foo#become:bar`\
.. Collection note
.. note::
This become plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This become plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo cache -- Foo files \ :ansopt:`ns2.col.foo#cache:bar`\
.. Collection note
.. note::
This cache plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This cache plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo callback -- Foo output \ :ansopt:`ns2.col.foo#callback:bar`\
.. Collection note
.. note::
This callback plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This callback plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo cliconf -- Foo router CLI config
.. Collection note
.. note::
This cliconf plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This cliconf plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo connection -- Foo connection \ :ansopt:`ns2.col.foo#connection:bar`\
.. Collection note
.. note::
This connection plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This connection plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo filter -- The foo filter \ :ansopt:`ns2.col.foo#filter:bar`\
.. Collection note
.. note::
This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This filter plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo inventory -- The foo inventory \ :ansopt:`ns2.col.foo#inventory:bar`
.. Collection note
.. note::
This inventory plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This inventory plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo lookup -- Look up some foo \ :ansopt:`ns2.col.foo#lookup:bar`\
.. Collection note
.. note::
This lookup plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This lookup plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo module -- Do some foo \ :ansopt:`ns2.col.foo#module:bar`\
.. Collection note
.. note::
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ns2.col.foo_redirect module
.. Collection note
.. note::
This redirect is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This redirect is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

To use it in a playbook, specify: :code:`ns2.col.foo_redirect`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ns2.col.foo role -- Foo role
.. Collection note
.. note::
This role is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This role is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo shell -- Foo shell \ :ansopt:`ns2.col.foo#shell:bar`\
.. Collection note
.. note::
This shell plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This shell plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo strategy -- Executes tasks in foo
.. Collection note
.. note::
This strategy plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This strategy plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo test -- Is something a foo \ :ansopt:`ns2.col.foo#test:bar`\
.. Collection note
.. note::
This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This test plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.foo vars -- Load foo \ :ansopt:`ns2.col.foo#vars:bar`\
.. Collection note
.. note::
This vars plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This vars plugin is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ns2.col.is_bar test
.. Collection note
.. note::
This redirect is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This redirect is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

To use it in a playbook, specify: :code:`ns2.col.is_bar`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ns2.col.sub.foo3 module -- A sub-foo
.. Collection note
.. note::
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ns2/col>`_ (version 2.1.0).
This module is part of the `ns2.col collection <https://galaxy.ansible.com/ui/repo/published/ns2/col/>`_ (version 2.1.0).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns2.flatcol.foo2 module -- Another foo
.. Collection note
.. note::
This module is part of the `ns2.flatcol collection <https://galaxy.ansible.com/ns2/flatcol>`_.
This module is part of the `ns2.flatcol collection <https://galaxy.ansible.com/ui/repo/published/ns2/flatcol/>`_.

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns2.flatcol.foo module -- Do some foo \ :ansopt:`ns2.flatcol.foo#module:bar`\
.. Collection note
.. note::
This module is part of the `ns2.flatcol collection <https://galaxy.ansible.com/ns2/flatcol>`_.
This module is part of the `ns2.flatcol collection <https://galaxy.ansible.com/ui/repo/published/ns2/flatcol/>`_.

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ns.col2.bar role -- Bar role
.. Collection note
.. note::
This role is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This role is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ns.col2.foo2 module -- Foo two
.. Collection note
.. note::
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ns/col2>`_ (version 0.0.1).
This module is part of the `ns.col2 collection <https://galaxy.ansible.com/ui/repo/published/ns/col2/>`_ (version 0.0.1).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
Loading

0 comments on commit 02b450d

Please sign in to comment.