Skip to content

Commit

Permalink
Merge pull request #65 from opsmill/refresh-sdk-envvar
Browse files Browse the repository at this point in the history
Refresh sdk envvar
  • Loading branch information
BeArchiTek authored May 21, 2024
2 parents b18a287 + a091d23 commit 6321093
Show file tree
Hide file tree
Showing 23 changed files with 120 additions and 70 deletions.
4 changes: 2 additions & 2 deletions docs/inventory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ Examples

# Minimum required parameters
plugin: opsmill.infrahub.inventory
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_API environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_TOKEN environment variable is set
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_ADDRESS environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_API_TOKEN environment variable is set

# Complete Example
# This will :
Expand Down
8 changes: 4 additions & 4 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.10.0
:antsibull-docs: 2.11.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.6).
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).

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

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

Endpoint of the Infrahub API, optional env=INFRAHUB\_API
Endpoint of the Infrahub API, optional env=INFRAHUB\_ADDRESS


.. raw:: html
Expand Down Expand Up @@ -296,7 +296,7 @@ Parameters

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

The API token created through Infrahub, optional env=INFRAHUB\_TOKEN
The API token created through Infrahub, optional env=INFRAHUB\_API\_TOKEN


.. raw:: html
Expand Down
6 changes: 3 additions & 3 deletions 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.10.0
:antsibull-docs: 2.11.0

.. _list_of_collection_env_vars:

Expand All @@ -18,14 +18,14 @@ Environment variables used by the ansible-core configuration are documented in :

*Used by:*
:ansplugin:`opsmill.infrahub.inventory inventory plugin <opsmill.infrahub.inventory#inventory>`
.. envvar:: INFRAHUB_API
.. envvar:: INFRAHUB_ADDRESS

Endpoint of the Infrahub API

*Used by:*
:ansplugin:`opsmill.infrahub.inventory inventory plugin <opsmill.infrahub.inventory#inventory>`,
:ansplugin:`opsmill.infrahub.lookup lookup plugin <opsmill.infrahub.lookup#lookup>`
.. envvar:: INFRAHUB_TOKEN
.. envvar:: INFRAHUB_API_TOKEN

Infrahub API token to be able to read against Infrahub.

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.10.0
:antsibull-docs: 2.11.0


.. _plugins_in_opsmill.infrahub:

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

Collection version 1.0.6
Collection version 1.0.8

.. contents::
:local:
Expand Down
5 changes: 3 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.10.0
:antsibull-docs: 2.11.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.6).
This role is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down Expand Up @@ -458,6 +458,7 @@ Parameters
.. Extra links
Collection links
Expand Down
35 changes: 25 additions & 10 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.10.0
:antsibull-docs: 2.11.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.6).
This inventory plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).

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

:ansible-option-configuration:`Configuration:`

- Environment variable: :envvar:`INFRAHUB\_API`
- Environment variable: :envvar:`INFRAHUB\_ADDRESS`


.. raw:: html
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 Expand Up @@ -1361,7 +1376,7 @@ Parameters

:ansible-option-configuration:`Configuration:`

- Environment variable: :envvar:`INFRAHUB\_TOKEN`
- Environment variable: :envvar:`INFRAHUB\_API\_TOKEN`


.. raw:: html
Expand Down Expand Up @@ -1497,8 +1512,8 @@ Examples

# Minimum required parameters
plugin: opsmill.infrahub.inventory
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_API environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_TOKEN environment variable is set
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_ADDRESS environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_API_TOKEN environment variable is set

# Complete Example
# This will :
Expand Down
8 changes: 4 additions & 4 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.10.0
:antsibull-docs: 2.11.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.6).
This lookup plugin is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).

It is not included in ``ansible-core``.
To check whether it is installed, run :code:`ansible-galaxy collection list`.
Expand Down Expand Up @@ -116,7 +116,7 @@ examples: ``lookup('opsmill.infrahub.lookup', key1=value1, key2=value2, ...)`` a

:ansible-option-configuration:`Configuration:`

- Environment variable: :envvar:`INFRAHUB\_API`
- Environment variable: :envvar:`INFRAHUB\_ADDRESS`


.. raw:: html
Expand Down Expand Up @@ -320,7 +320,7 @@ examples: ``lookup('opsmill.infrahub.lookup', key1=value1, key2=value2, ...)`` a

:ansible-option-configuration:`Configuration:`

- Environment variable: :envvar:`INFRAHUB\_TOKEN`
- Environment variable: :envvar:`INFRAHUB\_API\_TOKEN`


.. raw:: html
Expand Down
8 changes: 4 additions & 4 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.10.0
:antsibull-docs: 2.11.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.6).
This module is part of the `opsmill.infrahub collection <https://galaxy.ansible.com/ui/repo/published/opsmill/infrahub/>`_ (version 1.0.8).

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

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

Endpoint of the Infrahub API, optional env=INFRAHUB\_API
Endpoint of the Infrahub API, optional env=INFRAHUB\_ADDRESS


.. raw:: html
Expand Down Expand Up @@ -300,7 +300,7 @@ Parameters

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

The API token created through Infrahub, optional env=INFRAHUB\_TOKEN
The API token created through Infrahub, optional env=INFRAHUB\_API\_TOKEN


.. raw:: html
Expand Down
4 changes: 2 additions & 2 deletions plugins/action/artifact_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def run(self, tmp=None, task_vars=None):

args = self._task.args

api_endpoint = args.get("api_endpoint") or os.getenv("INFRAHUB_API")
token = args.get("token") or os.getenv("INFRAHUB_TOKEN")
api_endpoint = args.get("api_endpoint") or os.getenv("INFRAHUB_ADDRESS")
token = args.get("token") or os.getenv("INFRAHUB_API_TOKEN")
if api_endpoint is None:
raise AnsibleError("Missing Infrahub API Endpoint")
if token is None:
Expand Down
4 changes: 2 additions & 2 deletions plugins/action/query_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def run(self, tmp=None, task_vars=None):

args = self._task.args

api_endpoint = args.get("api_endpoint") or os.getenv("INFRAHUB_API")
token = args.get("token") or os.getenv("INFRAHUB_TOKEN")
api_endpoint = args.get("api_endpoint") or os.getenv("INFRAHUB_ADDRESS")
token = args.get("token") or os.getenv("INFRAHUB_API_TOKEN")
if api_endpoint is None:
raise AnsibleError("Missing Infrahub API Endpoint")
if token is None:
Expand Down
4 changes: 2 additions & 2 deletions plugins/doc_fragments/fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class ModuleDocFragment(object):
description: Endpoint of the Infrahub API
required: True
env:
- name: INFRAHUB_API
- name: INFRAHUB_ADDRESS
token:
required: True
description:
- Infrahub API token to be able to read against Infrahub.
env:
- name: INFRAHUB_TOKEN
- name: INFRAHUB_API_TOKEN
timeout:
required: False
description: Timeout for Infrahub requests in seconds
Expand Down
8 changes: 4 additions & 4 deletions plugins/inventory/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
description: Endpoint of the Infrahub API
required: True
env:
- name: INFRAHUB_API
- name: INFRAHUB_ADDRESS
token:
required: True
description:
- Infrahub API token to be able to read against Infrahub.
env:
- name: INFRAHUB_TOKEN
- name: INFRAHUB_API_TOKEN
timeout:
required: False
description: Timeout for Infrahub requests in seconds
Expand Down Expand Up @@ -102,8 +102,8 @@
# Minimum required parameters
plugin: opsmill.infrahub.inventory
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_API environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_TOKEN environment variable is set
api_endpoint: http://localhost:8000 # Can be omitted if the INFRAHUB_ADDRESS environment variable is set
token: 1234567890123456478901234567 # Can be omitted if the INFRAHUB_API_TOKEN environment variable is set
# Complete Example
# This will :
Expand Down
8 changes: 4 additions & 4 deletions plugins/lookup/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
description: Endpoint of the Infrahub API
required: True
env:
- name: INFRAHUB_API
- name: INFRAHUB_ADDRESS
token:
required: True
description:
- Infrahub API token to be able to read against Infrahub.
env:
- name: INFRAHUB_TOKEN
- name: INFRAHUB_API_TOKEN
timeout:
required: False
description: Timeout for Infrahub requests in seconds
Expand Down Expand Up @@ -130,8 +130,8 @@ def run(self, terms, variables=None, query=None, graph_variables=None, **kwargs)
if not HAS_INFRAHUBCLIENT:
raise (AnsibleError("infrahub_sdk must be installed to use this plugin"))

api_endpoint = kwargs.get("api_endpoint") or os.getenv("INFRAHUB_API")
token = kwargs.get("token") or os.getenv("INFRAHUB_TOKEN")
api_endpoint = kwargs.get("api_endpoint") or os.getenv("INFRAHUB_ADDRESS")
token = kwargs.get("token") or os.getenv("INFRAHUB_API_TOKEN")
if api_endpoint is None:
raise AnsibleLookupError("Missing Infrahub API Endpoint ")
if token is None:
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/artifact_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
api_endpoint:
required: False
description:
- Endpoint of the Infrahub API, optional env=INFRAHUB_API
- Endpoint of the Infrahub API, optional env=INFRAHUB_ADDRESS
type: str
token:
required: False
description:
- The API token created through Infrahub, optional env=INFRAHUB_TOKEN
- The API token created through Infrahub, optional env=INFRAHUB_API_TOKEN
type: str
timeout:
required: False
Expand Down
Loading

0 comments on commit 6321093

Please sign in to comment.