summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cloud/common/plugins
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-18 05:52:35 +0000
commit7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch)
treeefb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/cloud/common/plugins
parentReleasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff)
downloadansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz
ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.zip
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cloud/common/plugins')
-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
3 files changed, 17 insertions, 1 deletions
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