Skip to content

Commit

Permalink
Always provide metadata of ansible.builtin.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Nov 28, 2022
1 parent ba4c1c6 commit f688971
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/antsibull_docs/data/collection-enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,10 @@ def main(args):
collection_name = f'{meta["namespace"]}.{meta["name"]}'
if match_filter(collection_name, coll_filter):
result['collections'][collection_name] = meta
if match_filter('ansible.builtin', coll_filter):
result['collections']['ansible.builtin'] = {
'path': os.path.dirname(ansible_release.__file__),
'version': ansible_release.__version__,
}
result['collections']['ansible.builtin'] = {
'path': os.path.dirname(ansible_release.__file__),
'version': ansible_release.__version__,
}

print(json.dumps(
result, cls=AnsibleJSONEncoder, sort_keys=True, indent=4 if arguments.pretty else None))
Expand Down
11 changes: 5 additions & 6 deletions src/antsibull_docs/docs_parsing/ansible_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,11 @@ def get_collection_metadata(venv: t.Union['VenvRunner', 'FakeVenvRunner'],
) -> t.Dict[str, AnsibleCollectionMetadata]:
collection_metadata = {}

# Obtain ansible.builtin version
if collection_names is None or 'ansible.builtin' in collection_names:
venv_ansible = venv.get_command('ansible')
ansible_version_cmd = venv_ansible('--version', _env=env)
raw_result = ansible_version_cmd.stdout.decode('utf-8', errors='surrogateescape')
collection_metadata['ansible.builtin'] = _extract_ansible_builtin_metadata(raw_result)
# Obtain ansible.builtin version and path
venv_ansible = venv.get_command('ansible')
ansible_version_cmd = venv_ansible('--version', _env=env)
raw_result = ansible_version_cmd.stdout.decode('utf-8', errors='surrogateescape')
collection_metadata['ansible.builtin'] = _extract_ansible_builtin_metadata(raw_result)

# Obtain collection versions
venv_ansible_galaxy = venv.get_command('ansible-galaxy')
Expand Down
5 changes: 3 additions & 2 deletions src/antsibull_docs/docs_parsing/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ async def get_ansible_plugin_info(venv: t.Union['VenvRunner', 'FakeVenvRunner'],
{information from ansible-doc --json. See the ansible-doc documentation
for more info.}
The second component is a Mapping of collection names to metadata.
The second component is a Mapping of collection names to metadata. The second mapping
always includes the metadata for ansible.builtin, even if it was not explicitly
mentioned in ``collection_names``.
"""
flog = mlog.fields(func='get_ansible_plugin_info')

Expand Down

0 comments on commit f688971

Please sign in to comment.