From f0bcb7f477d75cce56cd75196f7c3005650c03e2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:10:10 +0100 Subject: [PATCH] [PR #9085/9553dd9d backport][stable-8] Stop using ansible.module_utils.compat.importlib (#9088) Stop using ansible.module_utils.compat.importlib (#9085) Stop using ansible.module_utils.compat.importlib. (cherry picked from commit 9553dd9ddf96d728cb0fc43bcc8d3702780a8c01) Co-authored-by: Felix Fontein --- changelogs/fragments/9084-collection_version-importlib.yml | 2 ++ plugins/lookup/collection_version.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/9084-collection_version-importlib.yml diff --git a/changelogs/fragments/9084-collection_version-importlib.yml b/changelogs/fragments/9084-collection_version-importlib.yml new file mode 100644 index 0000000000..827b9653d2 --- /dev/null +++ b/changelogs/fragments/9084-collection_version-importlib.yml @@ -0,0 +1,2 @@ +bugfixes: + - "collection_version lookup plugin - use ``importlib`` directly instead of the deprecated and in ansible-core 2.19 removed ``ansible.module_utils.compat.importlib`` (https://github.com/ansible-collections/community.general/pull/9084)." diff --git a/plugins/lookup/collection_version.py b/plugins/lookup/collection_version.py index 33316fc2b0..0f93c03c26 100644 --- a/plugins/lookup/collection_version.py +++ b/plugins/lookup/collection_version.py @@ -63,11 +63,11 @@ RETURN = """ import json import os import re +from importlib import import_module import yaml from ansible.errors import AnsibleLookupError -from ansible.module_utils.compat.importlib import import_module from ansible.plugins.lookup import LookupBase