summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cloud
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:22 +0000
commit38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch)
tree356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/cloud
parentAdding upstream version 7.7.0+dfsg. (diff)
downloadansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz
ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--ansible_collections/cloud/common/.github/workflows/changelog.yml22
-rw-r--r--ansible_collections/cloud/common/.github/workflows/linters.yml16
-rw-r--r--ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml172
-rw-r--r--ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml63
-rw-r--r--ansible_collections/cloud/common/CHANGELOG.rst14
-rw-r--r--ansible_collections/cloud/common/CI.md12
-rw-r--r--ansible_collections/cloud/common/FILES.json88
-rw-r--r--ansible_collections/cloud/common/MANIFEST.json4
-rw-r--r--ansible_collections/cloud/common/README.md6
-rw-r--r--ansible_collections/cloud/common/bindep.txt (renamed from ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases)0
-rw-r--r--ansible_collections/cloud/common/changelogs/changelog.yaml13
-rw-r--r--ansible_collections/cloud/common/meta/runtime.yml2
-rw-r--r--ansible_collections/cloud/common/plugins/module_utils/turbo/server.py14
-rw-r--r--ansible_collections/cloud/common/plugins/modules/turbo_fail.py1
-rw-r--r--ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py3
-rw-r--r--ansible_collections/cloud/common/pytest.ini2
-rw-r--r--ansible_collections/cloud/common/test-requirements.txt1
-rw-r--r--ansible_collections/cloud/common/tests/sanity/ignore-2.16.txt1
-rw-r--r--ansible_collections/cloud/common/tests/unit/plugins/module_utils/turbo/test_turbo_module.py6
19 files changed, 424 insertions, 16 deletions
diff --git a/ansible_collections/cloud/common/.github/workflows/changelog.yml b/ansible_collections/cloud/common/.github/workflows/changelog.yml
new file mode 100644
index 000000000..40b5bccf9
--- /dev/null
+++ b/ansible_collections/cloud/common/.github/workflows/changelog.yml
@@ -0,0 +1,22 @@
+---
+name: CI
+
+concurrency:
+ group: changelog-${{ github.ref }}
+ cancel-in-progress: true
+
+on:
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - labeled
+ - unlabeled
+ - synchronize
+ branches:
+ - main
+ - stable-*
+
+jobs:
+ changelog:
+ uses: ansible-network/github_actions/.github/workflows/changelog.yml@main \ No newline at end of file
diff --git a/ansible_collections/cloud/common/.github/workflows/linters.yml b/ansible_collections/cloud/common/.github/workflows/linters.yml
new file mode 100644
index 000000000..cafab80ae
--- /dev/null
+++ b/ansible_collections/cloud/common/.github/workflows/linters.yml
@@ -0,0 +1,16 @@
+---
+name: CI
+
+concurrency:
+ group: linters-${{ github.ref }}
+ cancel-in-progress: true
+
+on: # yamllint disable-line rule:truthy
+ pull_request:
+ branches:
+ - main
+ - stable-*
+
+jobs:
+ linters:
+ uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main \ No newline at end of file
diff --git a/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml b/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml
new file mode 100644
index 000000000..c2cc86756
--- /dev/null
+++ b/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml
@@ -0,0 +1,172 @@
+---
+name: CI
+
+concurrency:
+ group: sanity-units-${{ github.ref }}
+ cancel-in-progress: true
+
+on: # yamllint disable-line rule:truthy
+ pull_request:
+ branches:
+ - main
+ - stable-*
+ schedule:
+ - cron: '0 14 * * 1'
+
+jobs:
+ sanity:
+ uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
+ with:
+ matrix_include: "[]"
+ matrix_exclude: >-
+ [
+ {
+ "ansible-version": "stable-2.9",
+ "python-version": "3.9"
+ },
+ {
+ "ansible-version": "stable-2.9",
+ "python-version": "3.10"
+ },
+ {
+ "ansible-version": "stable-2.9",
+ "python-version": "3.11"
+ },
+ {
+ "ansible-version": "stable-2.12",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.12",
+ "python-version": "3.11"
+ },
+ {
+ "ansible-version": "stable-2.13",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.13",
+ "python-version": "3.11"
+ },
+ {
+ "ansible-version": "stable-2.14",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.14",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "stable-2.15",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.15",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.9"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.9"
+ }
+ ]
+ unit-source:
+ # Runs on ansible-2.12+
+ uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
+ with:
+ matrix_exclude: >-
+ [
+ {
+ "python-version": "3.11"
+ },
+ {
+ "ansible-version": "stable-2.12",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.13",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.12",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "stable-2.13",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "stable-2.14",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.14",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "stable-2.15",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "stable-2.15",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "milestone",
+ "python-version": "3.9"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.7"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.8"
+ },
+ {
+ "ansible-version": "devel",
+ "python-version": "3.9"
+ }
+ ]
+ collection_pre_install: ''
+ all_green:
+ if: ${{ always() }}
+ needs:
+ - sanity
+ - unit-source
+ runs-on: ubuntu-latest
+ steps:
+ - run: >-
+ python -c "assert set([
+ '${{ needs.unit-source.result }}'
+ ]) == {'success'}"
+ - run: >-
+ python -c "assert '${{ needs.sanity.result }}'
+ in ['success', 'failure']"
diff --git a/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml b/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml
new file mode 100644
index 000000000..779d5474d
--- /dev/null
+++ b/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml
@@ -0,0 +1,63 @@
+name: CI
+
+concurrency:
+ group: units-29-${{ github.ref }}
+ cancel-in-progress: true
+
+on: # yamllint disable-line rule:truthy
+ push:
+ branches:
+ - main
+ - stable-*
+ pull_request:
+ branches:
+ - main
+ - stable-*
+ schedule:
+ - cron: '0 14 * * 1'
+
+jobs:
+ units:
+ runs-on: ubuntu-20.04
+ name: unit-2.9
+ env:
+ ansible_version: stable-2.9
+ python_version: 3.7
+ steps:
+ - name: Checkout the collection repository
+ uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
+ with:
+ path: ${{ env.source_directory }}
+
+ - name: Set up Python ${{ env.python_version }}
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.python_version }}
+
+ - name: Install ansible-core (${{ env.ansible_version }})
+ run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ env.ansible_version }}.tar.gz --disable-pip-version-check
+
+ - name: Read collection metadata from galaxy.yml
+ id: identify
+ uses: ansible-network/github_actions/.github/actions/identify_collection@main
+ with:
+ source_path: ${{ env.source_directory }}
+
+ - name: Build and install the collection
+ uses: ansible-network/github_actions/.github/actions/build_install_collection@main
+ with:
+ install_python_dependencies: true
+ source_path: ${{ env.source_directory }}
+ collection_path: ${{ steps.identify.outputs.collection_path }}
+ tar_file: ${{ steps.identify.outputs.tar_file }}
+ ansible_version: "${{ env.ansible_version }}"
+
+ - name: Print the ansible version
+ run: ansible --version
+
+ - name: Print the python dependencies
+ run: python3 -m pip list
+
+ - name: Run unit tests
+ run: python -m pytest tests/unit --showlocals
+ working-directory: ${{ steps.identify.outputs.collection_path }}
diff --git a/ansible_collections/cloud/common/CHANGELOG.rst b/ansible_collections/cloud/common/CHANGELOG.rst
index af0074c06..95285f7e2 100644
--- a/ansible_collections/cloud/common/CHANGELOG.rst
+++ b/ansible_collections/cloud/common/CHANGELOG.rst
@@ -5,6 +5,20 @@ cloud.common Release Notes
.. contents:: Topics
+v2.1.4
+======
+
+Release Summary
+---------------
+
+This release includes several bugfixes for lookup plugins.
+
+Bugfixes
+--------
+
+- Ensure result is always defined in lookup plugins (https://github.com/ansible-collections/cloud.common/pull/116/files).
+- Fix lookup modules failing on Ansible 2.15 (https://github.com/ansible-collections/cloud.common/pull/130).
+
v2.1.3
======
diff --git a/ansible_collections/cloud/common/CI.md b/ansible_collections/cloud/common/CI.md
new file mode 100644
index 000000000..de1567bbe
--- /dev/null
+++ b/ansible_collections/cloud/common/CI.md
@@ -0,0 +1,12 @@
+# CI
+
+## cloud.common Collection
+
+GitHub Actions are used to run the Continuous Integration for ansible-collections/cloud.common collection. The workflows used for the CI can be found [here](https://github.com/ansible-collections/cloud.common/tree/main/.github/workflows). These workflows include jobs to run the unit tests, sanity tests, linters and changelog check. The following table lists the python and ansible versions against which these jobs are run.
+
+| Jobs | Description | Python Versions | Ansible Versions |
+| ------ |-------| ------ | -----------|
+| changelog |Checks for the presence of Changelog fragments | 3.9 | devel |
+| Linters | Runs `black` and `flake8` on plugins and tests | 3.9 | devel |
+| Unit tests | Executes the unit test cases | 3.6, 3.7, 3.9, 3.10 | Stable-2.9 (py 3.6, 3.7), Stable-2.12+ (py 3.8+)|
+| Sanity | Runs ansible sanity checks | 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 | Stable-2.9 (3.6, 3.7), Stable-2.12, 2.13, 2.14 (not on py 3.11), Stable-2.15+ (not on 3.8) |
diff --git a/ansible_collections/cloud/common/FILES.json b/ansible_collections/cloud/common/FILES.json
index 21e0a535e..a23528a12 100644
--- a/ansible_collections/cloud/common/FILES.json
+++ b/ansible_collections/cloud/common/FILES.json
@@ -8,6 +8,48 @@
"format": 1
},
{
+ "name": ".github",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/changelog.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "15ef7af9b356986f0ecad4c9b251c8bfb88d4e40ad2ff1ae9e23127df0be8a29",
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/linters.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "53ea8cad53e067156aa4bdd432fc05371d3c4e8e82b06ad77d42bed22ac165e1",
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/sanity_and_units.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ff67be1c0f4fbfa795ca723ca75c5339d3c641206828a2bd1a0d2a683d753a92",
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/unit-ansible-2.9.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6da10d31e601196c276d4e14f66499beb0f1f55208eb8e71d00fc3b600d82dfa",
+ "format": 1
+ },
+ {
"name": "changelogs",
"ftype": "dir",
"chksum_type": null,
@@ -32,7 +74,7 @@
"name": "changelogs/changelog.yaml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "1227088c4dfdbd9290835fcb4dbc00bb0376c326e8c9d8fbc38f87ca4e881fd5",
+ "chksum_sha256": "ad23e3b397d21ce7df780bbb5d5eab1297b3ac88973cec18e0371ab60d6b6ffb",
"format": 1
},
{
@@ -53,7 +95,7 @@
"name": "meta/runtime.yml",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "df18179bb2f5447a56ac92261a911649b96821c0b2c08eea62d5cc6b0195203f",
+ "chksum_sha256": "535568680e7ecac4940996890d5c31e4b43aa1bfe90452610902fade3e8b1521",
"format": 1
},
{
@@ -116,7 +158,7 @@
"name": "plugins/module_utils/turbo/server.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "2ce2d1796d3e23eacbc70a25b0decdbbb16132535b322cfba8d8c3af2224bb3c",
+ "chksum_sha256": "9de1df379e205f0e9be29cba7480aadfb00c9ed164e9d29de0f5200bfb1874d2",
"format": 1
},
{
@@ -144,7 +186,7 @@
"name": "plugins/modules/turbo_fail.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "0fadd01d905bf6bf22d8d8e59e66f30302afb419af84fed0b385b479da5a2db8",
+ "chksum_sha256": "a2a80de946f0b687e6b2182c74a467279e87009a5aadbf5344ce7412ca94fce1",
"format": 1
},
{
@@ -172,7 +214,7 @@
"name": "plugins/plugin_utils/turbo/lookup.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "d2665aa7917683e56d9bbc381cc4f1a72d64b28918606ca410a77d0d59d31fc6",
+ "chksum_sha256": "ddd2a780197cf8c3540c9a831b91b74ba40b566345e122ed2f15faeaa44967eb",
"format": 1
},
{
@@ -351,6 +393,13 @@
"format": 1
},
{
+ "name": "tests/sanity/ignore-2.16.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6ade72ead3ea9bfa27bc079c9f4f9dddc8fc29e3e5ae5cabb2e2e7666317485e",
+ "format": 1
+ },
+ {
"name": "tests/sanity/ignore-2.9.txt",
"ftype": "file",
"chksum_type": "sha256",
@@ -403,7 +452,7 @@
"name": "tests/unit/plugins/module_utils/turbo/test_turbo_module.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "4d3b03bc47f212e818291b4eff7e925bd296ebb0028134856a33c0570e532f5f",
+ "chksum_sha256": "6ec409210b6c84bc4418771ffa6a5543742dc78e710246405bd17a9bc7326850",
"format": 1
},
{
@@ -424,7 +473,14 @@
"name": "CHANGELOG.rst",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "f07881d2e19c49339cd8dbc8e3db2b67f3643b76537763b2d4b30cea5997376e",
+ "chksum_sha256": "37e82a484e32691dd70a237e28b0eb0300cb77d98aaa48a1380f9698a156be40",
+ "format": 1
+ },
+ {
+ "name": "CI.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "40940b39299fdd0a70df5280291ed4612c95fa635f1b51d4ba22ca0653b5fabe",
"format": 1
},
{
@@ -438,7 +494,21 @@
"name": "README.md",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "7383f887e938aecbb1f8e56a2a66339d217372f54caee19dbddafe6e2479a97b",
+ "chksum_sha256": "77bab797767ac83a7a73e0314aea2370f5a3c5cee2d220c7dcd55ac7513486a1",
+ "format": 1
+ },
+ {
+ "name": "bindep.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "pytest.ini",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d2fc2c077aecb43b8d72cfd2d85f6a508309938c5b7cf596661fe0aeb39cb4f6",
"format": 1
},
{
@@ -452,7 +522,7 @@
"name": "test-requirements.txt",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "f2d896f892cafcbf0b9abb0739c94ec8c4e292b56525a9a9aef688bf5b02c096",
+ "chksum_sha256": "cd90d58c7b3416cc0feb7f54e21680fd09f2fc5727f392006b834beb7459caf5",
"format": 1
},
{
diff --git a/ansible_collections/cloud/common/MANIFEST.json b/ansible_collections/cloud/common/MANIFEST.json
index 143d87920..caed94f54 100644
--- a/ansible_collections/cloud/common/MANIFEST.json
+++ b/ansible_collections/cloud/common/MANIFEST.json
@@ -2,7 +2,7 @@
"collection_info": {
"namespace": "cloud",
"name": "common",
- "version": "2.1.3",
+ "version": "2.1.4",
"authors": [
"Ansible (https://github.com/ansible)"
],
@@ -24,7 +24,7 @@
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "70df134410b54370a437423087e330ca15f24535beab03dd8e9f89acb7f944ae",
+ "chksum_sha256": "272fd687d00aee319c1ee38dfe287bf5aa9bd45eebe0f550ff61e294e7afcb8e",
"format": 1
},
"format": 1
diff --git a/ansible_collections/cloud/common/README.md b/ansible_collections/cloud/common/README.md
index 460a90612..ce1fcede9 100644
--- a/ansible_collections/cloud/common/README.md
+++ b/ansible_collections/cloud/common/README.md
@@ -8,7 +8,7 @@ More content may be included later.
# Requirements
-- ansible_turbo.module requires Python 3.6 and Ansible 2.9 or greater.
+- ansible_turbo.module requires Python 3.6 and Ansible 2.13.0 or greater.
## Ansible Turbo Module
@@ -173,7 +173,9 @@ You can use the `--help` argument to get a list of the optional parameters.
See [CHANGELOG.rst](https://github.com/ansible-collections/cloud.common/blob/main/CHANGELOG.rst).
-## Releasing, Versioning and Deprecation
+## Testing, Releasing, Versioning and Deprecation
+
+This collection is tested using GitHub Actions. To know more about CI, refer to [CI.md](https://github.com/ansible-collections/cloud.common/blob/main/CI.md).
This collection follows [Semantic Versioning](https://semver.org/). More details on versioning can be found [in the Ansible docs](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#collection-versions).
diff --git a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases b/ansible_collections/cloud/common/bindep.txt
index e69de29bb..e69de29bb 100644
--- a/ansible_collections/cisco/meraki/tests/integration/targets/meraki_mx_network_vlan_settings/aliases
+++ b/ansible_collections/cloud/common/bindep.txt
diff --git a/ansible_collections/cloud/common/changelogs/changelog.yaml b/ansible_collections/cloud/common/changelogs/changelog.yaml
index 09afb69e8..4ca93cad3 100644
--- a/ansible_collections/cloud/common/changelogs/changelog.yaml
+++ b/ansible_collections/cloud/common/changelogs/changelog.yaml
@@ -143,3 +143,16 @@ releases:
- pin_black_version.yml
- update_booleans.yml
release_date: '2023-03-15'
+ 2.1.4:
+ changes:
+ bugfixes:
+ - Ensure result is always defined in lookup plugins (https://github.com/ansible-collections/cloud.common/pull/116/files).
+ - Fix lookup modules failing on Ansible 2.15 (https://github.com/ansible-collections/cloud.common/pull/130).
+ release_summary: This release includes several bugfixes for lookup plugins.
+ fragments:
+ - 130-fix-ansible-2.15.yml
+ - 20230726-lookup.yml
+ - gh-workflow.yaml
+ - release_summary.yml
+ - update_ansible_version.yml
+ release_date: '2023-08-14'
diff --git a/ansible_collections/cloud/common/meta/runtime.yml b/ansible_collections/cloud/common/meta/runtime.yml
index 2ee3c9fa9..873e7979a 100644
--- a/ansible_collections/cloud/common/meta/runtime.yml
+++ b/ansible_collections/cloud/common/meta/runtime.yml
@@ -1,2 +1,2 @@
---
-requires_ansible: '>=2.9.10'
+requires_ansible: '>=2.13.0'
diff --git a/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py b/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py
index 77fbb6493..04ddf67f3 100644
--- a/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py
+++ b/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py
@@ -51,6 +51,7 @@ env_lock = None
import ansible.module_utils.basic
+
please_include_me = "bar"
@@ -224,6 +225,7 @@ async def run_as_lookup_plugin(data):
errors = None
from ansible.module_utils._text import to_native
+ result = None
try:
import ansible.plugins.loader as plugin_loader
from ansible.parsing.dataloader import DataLoader
@@ -257,10 +259,12 @@ async def run_as_lookup_plugin(data):
result = instance._run(terms, variables=variables, **kwargs)
except Exception as e:
errors = to_native(e)
+
return [result, errors]
async def run_as_module(content, debug_mode):
+ result = None
from ansible_collections.cloud.common.plugins.module_utils.turbo.exceptions import (
EmbeddedModuleFailure,
)
@@ -325,11 +329,13 @@ class AnsibleVMwareTurboMode:
self.stop()
async def handle(self, reader, writer):
+ result = None
self._watcher.cancel()
self._watcher = self.loop.create_task(self.ghost_killer())
job_id = str(uuid.uuid4())
self.jobs_ongoing[job_id] = datetime.now()
raw_data = await reader.read()
+
if not raw_data:
return
@@ -359,6 +365,14 @@ class AnsibleVMwareTurboMode:
import sys
+ try:
+ from ansible.plugins.loader import init_plugin_loader
+
+ init_plugin_loader()
+ except ImportError:
+ # Running on Ansible < 2.15
+ pass
+
if sys.hexversion >= 0x30A00B1:
# py3.10 drops the loop argument of create_task.
self.loop.create_task(
diff --git a/ansible_collections/cloud/common/plugins/modules/turbo_fail.py b/ansible_collections/cloud/common/plugins/modules/turbo_fail.py
index d9b4731f3..76be87160 100644
--- a/ansible_collections/cloud/common/plugins/modules/turbo_fail.py
+++ b/ansible_collections/cloud/common/plugins/modules/turbo_fail.py
@@ -31,7 +31,6 @@ EXAMPLES = r"""
test: "ansible"
"""
-import os
from ansible_collections.cloud.common.plugins.module_utils.turbo.module import (
AnsibleTurboModule as AnsibleModule,
diff --git a/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py b/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py
index 30adc1e96..627f665fc 100644
--- a/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py
+++ b/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py
@@ -74,12 +74,14 @@ class TurboLookupBase(LookupBase):
idx = name.find(lookup_plugins)
if idx != -1:
name = name[:idx]
+
self.__socket_path = os.environ[
"HOME"
] + "/.ansible/tmp/turbo_lookup.{0}.socket".format(name)
return self.__socket_path
def execute(self, terms, variables=None, **kwargs):
+ result = None
with ansible_collections.cloud.common.plugins.module_utils.turbo.common.connect(
socket_path=self.socket_path, ttl=self._ttl, plugin="lookup"
) as turbo_socket:
@@ -87,4 +89,5 @@ class TurboLookupBase(LookupBase):
(result, errors) = turbo_socket.communicate(content)
if errors:
raise EmbeddedModuleUnexpectedFailure(errors)
+
return result
diff --git a/ansible_collections/cloud/common/pytest.ini b/ansible_collections/cloud/common/pytest.ini
new file mode 100644
index 000000000..98f6015a4
--- /dev/null
+++ b/ansible_collections/cloud/common/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+addopts = --import-mode append
diff --git a/ansible_collections/cloud/common/test-requirements.txt b/ansible_collections/cloud/common/test-requirements.txt
index ee6352ad8..79bad3580 100644
--- a/ansible_collections/cloud/common/test-requirements.txt
+++ b/ansible_collections/cloud/common/test-requirements.txt
@@ -1,2 +1,3 @@
coverage==4.5.4
pytest-xdist
+pytest-ansible
diff --git a/ansible_collections/cloud/common/tests/sanity/ignore-2.16.txt b/ansible_collections/cloud/common/tests/sanity/ignore-2.16.txt
new file mode 100644
index 000000000..e7b94a256
--- /dev/null
+++ b/ansible_collections/cloud/common/tests/sanity/ignore-2.16.txt
@@ -0,0 +1 @@
+plugins/module_utils/turbo/server.py pylint:ansible-bad-module-import
diff --git a/ansible_collections/cloud/common/tests/unit/plugins/module_utils/turbo/test_turbo_module.py b/ansible_collections/cloud/common/tests/unit/plugins/module_utils/turbo/test_turbo_module.py
index 00756a0d3..6401046a0 100644
--- a/ansible_collections/cloud/common/tests/unit/plugins/module_utils/turbo/test_turbo_module.py
+++ b/ansible_collections/cloud/common/tests/unit/plugins/module_utils/turbo/test_turbo_module.py
@@ -4,7 +4,6 @@
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# py38 only, See: https://github.com/PyCQA/pylint/issues/2976
-from posixpath import dirname
from unittest.mock import Mock, ANY # pylint: disable=syntax-error
import time
import pytest
@@ -12,6 +11,8 @@ import socket
import subprocess
import os
import ansible.module_utils.basic
+from pathlib import Path
+import sys
from ansible_collections.cloud.common.plugins.module_utils.turbo.module import (
get_collection_name_from_path,
expand_argument_specs_aliases,
@@ -79,6 +80,9 @@ def test_start_daemon_from_lookup(monkeypatch):
def test_start_daemon_with_no_mock(tmp_path):
+ # This is an ugly fix to get this to pass in CI
+ p = Path.cwd().parents
+ sys.path.insert(0, str(p[2]))
my_socket = tmp_path / "socket"
turbo_socket = turbo_common.AnsibleTurboSocket(socket_path=str(my_socket), ttl=1)
assert turbo_socket.start_server()