Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BeArchiTek committed Jul 19, 2024
1 parent d31de9d commit 8366ea5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 28 deletions.
4 changes: 2 additions & 2 deletions docs/plugins/artifact_fetch_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:trim:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. Anchors
Expand All @@ -23,7 +23,7 @@ opsmill.infrahub.artifact_fetch module -- Fetch the content of an artifact from
.. Collection note
.. note::
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.9).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:orphan:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. _list_of_collection_env_vars:

Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@


.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0


.. _plugins_in_opsmill.infrahub:

Opsmill.Infrahub
================

Collection version 1.0.8
Collection version 1.0.9

.. contents::
:local:
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/install_role.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:trim:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. Anchors
Expand All @@ -21,7 +21,7 @@ opsmill.infrahub.install role -- Install Infrahub
.. Collection note
.. note::
This role is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).
This role is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.9).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
27 changes: 21 additions & 6 deletions docs/plugins/inventory_inventory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:trim:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. Anchors
Expand All @@ -23,7 +23,7 @@ opsmill.infrahub.inventory inventory -- Infrahub inventory source (using GraphQL
.. Collection note
.. note::
This inventory plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).
This inventory plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.9).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down Expand Up @@ -390,6 +390,21 @@ Parameters

- INI entries:

.. code-block::
[default]
fact_caching_prefix = ansible_inventory_
Removed in: version 2.16 of ansible.builtin


Why: Fixes typing error in INI section name

Alternative: Use the 'defaults' section instead



.. code-block::
[defaults]
Expand Down Expand Up @@ -645,7 +660,7 @@ Parameters

The default value when the host variable's value is an empty string.

This option is mutually exclusive with \ :ansopt:`opsmill.infrahub.inventory#inventory:keyed\_groups[].trailing\_separator`\ .
This option is mutually exclusive with \ :literal:`trailing\_separator`\ .


.. raw:: html
Expand Down Expand Up @@ -881,9 +896,9 @@ Parameters

<div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">

Set this option to \ :ansval:`False`\ to omit the \ :ansopt:`opsmill.infrahub.inventory#inventory:keyed\_groups[].separator`\ after the host variable when the value is an empty string.
Set this option to \ :emphasis:`False`\ to omit the \ :literal:`separator`\ after the host variable when the value is an empty string.

This option is mutually exclusive with \ :ansopt:`opsmill.infrahub.inventory#inventory:keyed\_groups[].default\_value`\ .
This option is mutually exclusive with \ :literal:`default\_value`\ .


.. rst-class:: ansible-option-line
Expand Down Expand Up @@ -1266,7 +1281,7 @@ Parameters

<div class="ansible-option-cell">

If \ :ansval:`yes`\ make invalid entries a fatal error, otherwise skip and continue.
If \ :literal:`yes`\ make invalid entries a fatal error, otherwise skip and continue.

Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.

Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/lookup_lookup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:trim:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. Anchors
Expand All @@ -23,7 +23,7 @@ opsmill.infrahub.lookup lookup -- Queries and returns elements from Infrahub (us
.. Collection note
.. note::
This lookup plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).
This lookup plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.9).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/query_graphql_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:trim:

.. meta::
:antsibull-docs: 2.11.0
:antsibull-docs: 2.12.0

.. Anchors
Expand All @@ -23,7 +23,7 @@ opsmill.infrahub.query_graphql module -- Queries and returns elements from Infra
.. Collection note
.. note::
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.9).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down
24 changes: 13 additions & 11 deletions plugins/module_utils/infrahub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ def __init__(self, client: InfrahubclientWrapper):
self.client = client

def resolve_node_mapping(
self, node: InfrahubNodeSync, attrs: List[str], schemas: Dict[str, NodeSchema], include_id: bool = True
) -> Optional[Dict[str, Any]]:
self, node: InfrahubNodeSync, attrs: List[str], schemas: Dict[str, NodeSchema], include_id: bool = True
) -> Optional[Dict[str, Any]]:
"""
Resolve the attributes and relationships of a given node based on a list of desired attributes.
Expand Down Expand Up @@ -334,7 +334,6 @@ def resolve_node_mapping(
attribute_dict[parts[0]] = node_attr.value

elif parts[0] in node._schema.relationship_names:

if isinstance(node_attr, RelationshipManagerSync):
if len(parts) == 1:
peers: List[Dict[str, Any]] = []
Expand All @@ -349,7 +348,9 @@ def resolve_node_mapping(

elif isinstance(node_attr, RelatedNodeSync):
if node_attr.id and node_attr.schema.peer:
related_node = store.get(key=node_attr.id, kind=node_attr.schema.peer, raise_when_missing=False)
related_node = store.get(
key=node_attr.id, kind=node_attr.schema.peer, raise_when_missing=False
)
if not related_node:
node_attr.fetch()
related_node = node_attr.peer
Expand Down Expand Up @@ -393,7 +394,7 @@ def get_attributes_for_schema(schema: NodeSchema, exclude: Optional[List[str]] =
continue
attributes_by_kind.append(attr_name)
for rel_name in schema.relationship_names:
if exclude and rel_name in schema.relationship_names:
if exclude and rel_name in exclude:
continue
rel_schema = schema.get_relationship_or_none(name=rel_name)
if not rel_schema:
Expand Down Expand Up @@ -493,7 +494,9 @@ def fetch_and_process(
continue

node_attributes_dict[node_kind] = (
include if include else self.get_attributes_for_schema(schema=schema_dict[node_kind], exclude=exclude)
include
if include
else self.get_attributes_for_schema(schema=schema_dict[node_kind], exclude=exclude)
)
all_nodes.extend(nodes_from_kind)

Expand All @@ -505,10 +508,7 @@ def fetch_and_process(
related_kinds = self.get_related_nodes(schema=schema_dict[node_kind], attrs=node_attributes)
for related_kind in related_kinds:
schema_dict[related_kind] = self.client.fetch_single_schema(kind=related_kind)
self.client.fetch_nodes(
kind=related_kind,
prefetch_relationships=False
)
self.client.fetch_nodes(kind=related_kind, prefetch_relationships=False)

for host_node in all_nodes:
result = self.resolve_node_mapping(
Expand Down Expand Up @@ -563,7 +563,9 @@ def fetch_and_process(
schema = self.client.fetch_single_schema(kind=node_kind)
node = self.client.client.store.get(result["node"]["id"], node_kind)
attrs = [attr for attr in result["node"].keys() if attr != "__typename"]
mapped_result = self.resolve_node_mapping(node=node, attrs=attrs, schemas={node_kind: schema}, include_id=include_id)
mapped_result = self.resolve_node_mapping(
node=node, attrs=attrs, schemas={node_kind: schema}, include_id=include_id
)
if mapped_result:
host_node_attributes[str(node)] = mapped_result

Expand Down

0 comments on commit 8366ea5

Please sign in to comment.