From 2cd1744be3d96f1eec674e1b66433c3730caa24f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 3 May 2023 08:58:00 -0700 Subject: Use ansible.module_utils.common.text.converters (#80704) Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility. --- hacking/ansible-profile | 2 +- hacking/build_library/build_ansible/command_plugins/collection_meta.py | 2 +- hacking/build_library/build_ansible/command_plugins/dump_config.py | 2 +- hacking/build_library/build_ansible/command_plugins/dump_keywords.py | 2 +- hacking/build_library/build_ansible/command_plugins/generate_man.py | 2 +- hacking/test-module.py | 2 +- hacking/tests/gen_distribution_version_testcase.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'hacking') diff --git a/hacking/ansible-profile b/hacking/ansible-profile index 8681cb739d..9856e7ab5c 100755 --- a/hacking/ansible-profile +++ b/hacking/ansible-profile @@ -7,7 +7,7 @@ import sys import traceback import ansible.constants as C -from ansible.module_utils._text import to_text +from ansible.module_utils.common.text.converters import to_text target = sys.argv.pop(1) myclass = "%sCLI" % target.capitalize() diff --git a/hacking/build_library/build_ansible/command_plugins/collection_meta.py b/hacking/build_library/build_ansible/command_plugins/collection_meta.py index 41b1077851..5c379a1d71 100644 --- a/hacking/build_library/build_ansible/command_plugins/collection_meta.py +++ b/hacking/build_library/build_ansible/command_plugins/collection_meta.py @@ -12,7 +12,7 @@ import pathlib import yaml from ansible.module_utils.six import string_types -from ansible.module_utils._text import to_bytes +from ansible.module_utils.common.text.converters import to_bytes from antsibull_docs.jinja2.environment import doc_environment # Pylint doesn't understand Python3 namespace modules. diff --git a/hacking/build_library/build_ansible/command_plugins/dump_config.py b/hacking/build_library/build_ansible/command_plugins/dump_config.py index 33591b4731..733f9503e9 100644 --- a/hacking/build_library/build_ansible/command_plugins/dump_config.py +++ b/hacking/build_library/build_ansible/command_plugins/dump_config.py @@ -12,7 +12,7 @@ import pathlib import yaml from jinja2 import Environment, FileSystemLoader -from ansible.module_utils._text import to_bytes +from ansible.module_utils.common.text.converters import to_bytes # Pylint doesn't understand Python3 namespace modules. from ..change_detection import update_file_if_different # pylint: disable=relative-beyond-top-level diff --git a/hacking/build_library/build_ansible/command_plugins/dump_keywords.py b/hacking/build_library/build_ansible/command_plugins/dump_keywords.py index e9379317f9..90a790f68b 100644 --- a/hacking/build_library/build_ansible/command_plugins/dump_keywords.py +++ b/hacking/build_library/build_ansible/command_plugins/dump_keywords.py @@ -16,7 +16,7 @@ import jinja2 import yaml from jinja2 import Environment, FileSystemLoader -from ansible.module_utils._text import to_bytes +from ansible.module_utils.common.text.converters import to_bytes # Pylint doesn't understand Python3 namespace modules. from ..change_detection import update_file_if_different # pylint: disable=relative-beyond-top-level diff --git a/hacking/build_library/build_ansible/command_plugins/generate_man.py b/hacking/build_library/build_ansible/command_plugins/generate_man.py index e9df138725..2d8d1b0ec4 100644 --- a/hacking/build_library/build_ansible/command_plugins/generate_man.py +++ b/hacking/build_library/build_ansible/command_plugins/generate_man.py @@ -14,7 +14,7 @@ import sys from jinja2 import Environment, FileSystemLoader -from ansible.module_utils._text import to_bytes +from ansible.module_utils.common.text.converters import to_bytes # Pylint doesn't understand Python3 namespace modules. from ..change_detection import update_file_if_different # pylint: disable=relative-beyond-top-level diff --git a/hacking/test-module.py b/hacking/test-module.py index 745acdbc7f..7a329b4b2d 100755 --- a/hacking/test-module.py +++ b/hacking/test-module.py @@ -47,7 +47,7 @@ from ansible.parsing.splitter import parse_kv from ansible.plugins.loader import init_plugin_loader from ansible.executor import module_common import ansible.constants as C -from ansible.module_utils._text import to_native, to_text +from ansible.module_utils.common.text.converters import to_native, to_text from ansible.template import Templar import json diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py index 2fc5a2f932..e75c78ad91 100755 --- a/hacking/tests/gen_distribution_version_testcase.py +++ b/hacking/tests/gen_distribution_version_testcase.py @@ -19,7 +19,7 @@ import subprocess import sys from ansible.module_utils import distro -from ansible.module_utils._text import to_text +from ansible.module_utils.common.text.converters import to_text filelist = [ -- cgit v1.2.3