diff options
Diffstat (limited to 'ansible_collections/cloud/common/plugins')
6 files changed, 21 insertions, 26 deletions
diff --git a/ansible_collections/cloud/common/plugins/lookup/turbo_demo.py b/ansible_collections/cloud/common/plugins/lookup/turbo_demo.py index 88778cd67..4d69b0d01 100644 --- a/ansible_collections/cloud/common/plugins/lookup/turbo_demo.py +++ b/ansible_collections/cloud/common/plugins/lookup/turbo_demo.py @@ -44,7 +44,7 @@ if True: # pylint: disable=using-constant-test async def execute(terms, variables, playbook_vars): result = [] - result.append("running from pid: {pid}".format(pid=os.getpid())) + result.append(f"running from pid: {os.getpid()}") if playbook_vars is not None: result += [ variables["vars"].get(x) for x in playbook_vars if x in variables["vars"] @@ -57,7 +57,7 @@ async def execute(terms, variables, playbook_vars): if fname == __file__: continue - result.append("turbo_demo_counter: {0}".format(counter())) + result.append(f"turbo_demo_counter: {counter()}") return result diff --git a/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py b/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py index e5ad19383..ebe9b0c2a 100644 --- a/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py +++ b/ansible_collections/cloud/common/plugins/module_utils/turbo/common.py @@ -25,18 +25,16 @@ # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +import json import os +import pickle import socket +import subprocess import sys import time -import subprocess -import pickle from contextlib import contextmanager -import json -from .exceptions import ( - EmbeddedModuleUnexpectedFailure, -) +from .exceptions import EmbeddedModuleUnexpectedFailure class AnsibleTurboSocket: @@ -107,7 +105,7 @@ class AnsibleTurboSocket: return result except json.decoder.JSONDecodeError: raise EmbeddedModuleUnexpectedFailure( - "Cannot decode plugin answer: {0}".format(raw_answer) + f"Cannot decode plugin answer: {raw_answer}" ) def close(self): diff --git a/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py b/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py index c2f9d667e..64b9fba42 100644 --- a/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py +++ b/ansible_collections/cloud/common/plugins/module_utils/turbo/module.py @@ -32,12 +32,10 @@ import sys import tempfile import ansible.module_utils.basic -from .exceptions import ( - EmbeddedModuleSuccess, - EmbeddedModuleFailure, -) import ansible_collections.cloud.common.plugins.module_utils.turbo.common +from .exceptions import EmbeddedModuleFailure, EmbeddedModuleSuccess + if False: # pylint: disable=using-constant-test from .server import please_include_me 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 04ddf67f3..2769580b4 100644 --- a/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py +++ b/ansible_collections/cloud/common/plugins/module_utils/turbo/server.py @@ -27,31 +27,30 @@ # import argparse import asyncio -from datetime import datetime + +# py38 only, See: https://github.com/PyCQA/pylint/issues/2976 +import collections # pylint: disable=syntax-error import importlib # py38 only, See: https://github.com/PyCQA/pylint/issues/2976 import inspect # pylint: disable=syntax-error import io import json - -# py38 only, See: https://github.com/PyCQA/pylint/issues/2976 -import collections # pylint: disable=syntax-error import os +import pickle import signal import sys import traceback +import uuid import zipfile +from datetime import datetime from zipimport import zipimporter -import pickle -import uuid sys_path_lock = None env_lock = None import ansible.module_utils.basic - please_include_me = "bar" @@ -180,8 +179,8 @@ class EmbeddedModule: from .exceptions import ( EmbeddedModuleFailure, - EmbeddedModuleUnexpectedFailure, EmbeddedModuleSuccess, + EmbeddedModuleUnexpectedFailure, ) # monkeypatching to pass the argument to the module, this is not diff --git a/ansible_collections/cloud/common/plugins/modules/turbo_fail.py b/ansible_collections/cloud/common/plugins/modules/turbo_fail.py index 76be87160..eae1ce2a2 100644 --- a/ansible_collections/cloud/common/plugins/modules/turbo_fail.py +++ b/ansible_collections/cloud/common/plugins/modules/turbo_fail.py @@ -28,7 +28,7 @@ EXAMPLES = r""" - name: Fail with additional arguments cloud.common.turbo_fail: params: - test: "ansible" + test: "ansible" """ 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 627f665fc..d0cc6d862 100644 --- a/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py +++ b/ansible_collections/cloud/common/plugins/plugin_utils/turbo/lookup.py @@ -27,8 +27,8 @@ import os -from ansible.plugins.lookup import LookupBase import ansible_collections.cloud.common.plugins.module_utils.turbo.common +from ansible.plugins.lookup import LookupBase from ansible_collections.cloud.common.plugins.module_utils.turbo.exceptions import ( EmbeddedModuleUnexpectedFailure, ) @@ -75,9 +75,9 @@ class TurboLookupBase(LookupBase): if idx != -1: name = name[:idx] - self.__socket_path = os.environ[ - "HOME" - ] + "/.ansible/tmp/turbo_lookup.{0}.socket".format(name) + self.__socket_path = ( + os.environ["HOME"] + f"/.ansible/tmp/turbo_lookup.{name}.socket" + ) return self.__socket_path def execute(self, terms, variables=None, **kwargs): |