diff --git a/docs/plugins/artifact_fetch_module.rst b/docs/plugins/artifact_fetch_module.rst index b5e4493..b67ccab 100644 --- a/docs/plugins/artifact_fetch_module.rst +++ b/docs/plugins/artifact_fetch_module.rst @@ -7,7 +7,7 @@ :trim: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. Anchors @@ -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 `_ (version 1.0.8). + This module is part of the `opsmill.infrahub collection `_ (version 1.0.9). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. diff --git a/docs/plugins/environment_variables.rst b/docs/plugins/environment_variables.rst index 0d1944d..2105045 100644 --- a/docs/plugins/environment_variables.rst +++ b/docs/plugins/environment_variables.rst @@ -2,7 +2,7 @@ :orphan: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. _list_of_collection_env_vars: diff --git a/docs/plugins/index.rst b/docs/plugins/index.rst index 1b9a8cf..f54ee02 100644 --- a/docs/plugins/index.rst +++ b/docs/plugins/index.rst @@ -1,7 +1,7 @@ .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. _plugins_in_opsmill.infrahub: @@ -9,7 +9,7 @@ Opsmill.Infrahub ================ -Collection version 1.0.8 +Collection version 1.0.9 .. contents:: :local: diff --git a/docs/plugins/install_role.rst b/docs/plugins/install_role.rst index 936f229..180d4a8 100644 --- a/docs/plugins/install_role.rst +++ b/docs/plugins/install_role.rst @@ -7,7 +7,7 @@ :trim: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. Anchors @@ -21,7 +21,7 @@ opsmill.infrahub.install role -- Install Infrahub .. Collection note .. note:: - This role is part of the `opsmill.infrahub collection `_ (version 1.0.8). + This role is part of the `opsmill.infrahub collection `_ (version 1.0.9). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. diff --git a/docs/plugins/inventory_inventory.rst b/docs/plugins/inventory_inventory.rst index f6a8026..d539769 100644 --- a/docs/plugins/inventory_inventory.rst +++ b/docs/plugins/inventory_inventory.rst @@ -7,7 +7,7 @@ :trim: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. Anchors @@ -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 `_ (version 1.0.8). + This inventory plugin is part of the `opsmill.infrahub collection `_ (version 1.0.9). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. @@ -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] @@ -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 @@ -881,9 +896,9 @@ Parameters
- 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 @@ -1266,7 +1281,7 @@ Parameters
- 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. diff --git a/docs/plugins/lookup_lookup.rst b/docs/plugins/lookup_lookup.rst index ea64124..4a63ff3 100644 --- a/docs/plugins/lookup_lookup.rst +++ b/docs/plugins/lookup_lookup.rst @@ -7,7 +7,7 @@ :trim: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. Anchors @@ -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 `_ (version 1.0.8). + This lookup plugin is part of the `opsmill.infrahub collection `_ (version 1.0.9). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. diff --git a/docs/plugins/query_graphql_module.rst b/docs/plugins/query_graphql_module.rst index 2185d91..2b77945 100644 --- a/docs/plugins/query_graphql_module.rst +++ b/docs/plugins/query_graphql_module.rst @@ -7,7 +7,7 @@ :trim: .. meta:: - :antsibull-docs: 2.11.0 + :antsibull-docs: 2.12.0 .. Anchors @@ -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 `_ (version 1.0.8). + This module is part of the `opsmill.infrahub collection `_ (version 1.0.9). It is not included in ``ansible-core``. To check whether it is installed, run :code:`ansible-galaxy collection list`. diff --git a/plugins/module_utils/infrahub_utils.py b/plugins/module_utils/infrahub_utils.py index 2a5f1e0..a49d535 100644 --- a/plugins/module_utils/infrahub_utils.py +++ b/plugins/module_utils/infrahub_utils.py @@ -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. @@ -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]] = [] @@ -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 @@ -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: @@ -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) @@ -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( @@ -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