From 37644b67eab9559b4d5faa6cd42411b0a2008368 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Tue, 26 Sep 2023 16:46:41 -0700 Subject: [PATCH] Add patch to fix readfp with python-3.12. Fixes rhbz#2239728 --- ...b1adba5d4a12f61ed268f67a224bdaa5f835.patch | 35 +++++++++++++++++++ ansible-core.spec | 8 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 a861b1adba5d4a12f61ed268f67a224bdaa5f835.patch diff --git a/a861b1adba5d4a12f61ed268f67a224bdaa5f835.patch b/a861b1adba5d4a12f61ed268f67a224bdaa5f835.patch new file mode 100644 index 0000000..61b5f8d --- /dev/null +++ b/a861b1adba5d4a12f61ed268f67a224bdaa5f835.patch @@ -0,0 +1,35 @@ +diff --color -Nur ansible-2.15.4.orig/lib/ansible/module_utils/facts/system/local.py ansible-2.15.4/lib/ansible/module_utils/facts/system/local.py +--- ansible-2.15.4.orig/lib/ansible/module_utils/facts/system/local.py 2023-09-11 15:11:17.000000000 -0700 ++++ ansible-2.15.4/lib/ansible/module_utils/facts/system/local.py 2023-09-26 16:31:21.030496975 -0700 +@@ -26,6 +26,7 @@ + from ansible.module_utils._text import to_text + from ansible.module_utils.facts.utils import get_file_content + from ansible.module_utils.facts.collector import BaseFactCollector ++from ansible.module_utils.six import PY3 + from ansible.module_utils.six.moves import configparser, StringIO + + +@@ -91,7 +92,10 @@ + # if that fails read it with ConfigParser + cp = configparser.ConfigParser() + try: +- cp.readfp(StringIO(out)) ++ if PY3: ++ cp.read_file(StringIO(out)) ++ else: ++ cp.readfp(StringIO(out)) + except configparser.Error: + fact = "error loading facts as JSON or ini - please check content: %s" % fn + module.warn(fact) +diff --color -Nur ansible-2.15.4.orig/lib/ansible/plugins/lookup/ini.py ansible-2.15.4/lib/ansible/plugins/lookup/ini.py +--- ansible-2.15.4.orig/lib/ansible/plugins/lookup/ini.py 2023-09-11 15:11:17.000000000 -0700 ++++ ansible-2.15.4/lib/ansible/plugins/lookup/ini.py 2023-09-26 16:31:56.603461044 -0700 +@@ -187,7 +187,7 @@ + config.seek(0, os.SEEK_SET) + + try: +- self.cp.readfp(config) ++ self.cp.read_file(config) + except configparser.DuplicateOptionError as doe: + raise AnsibleLookupError("Duplicate option in '{file}': {error}".format(file=paramvals['file'], error=to_native(doe))) + diff --git a/ansible-core.spec b/ansible-core.spec index 4253947..be7c35b 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -12,7 +12,7 @@ Name: ansible-core Summary: A radically simple IT automation system Version: 2.15.4 %global uversion %{version_no_tilde %{quote:%nil}} -Release: 1%{?dist} +Release: 2%{?dist} # The main license is GPLv3+. Many of the files in lib/ansible/module_utils # are BSD licensed. There are various files scattered throughout the codebase # containing code under different licenses. @@ -44,6 +44,9 @@ Patch6000: https://github.com/ansible/ansible/commit/676b731e6f7d60ce6fd48c0d1c8 Patch6003: https://github.com/ansible/ansible/commit/742d47fa15a5418f98abf9aaf07edf466e871c81.patch#/replace-deprecated-ast.value.s.patch # Avoid deprecated importlib.abc.TraversableResources (#81082) Patch6004: https://github.com/ansible/ansible/commit/bd5b0b4293f454819766437cb6f8a7037affd49e.patch#/avoid-importlib-resources-abc-deprecation.patch +# Fix for readfp with python-3.12. Already upstream (rhbz#2239728) +# (rebased on top of above patches) +Patch6005: https://github.com/ansible/ansible/commit/a861b1adba5d4a12f61ed268f67a224bdaa5f835.patch Url: https://ansible.com BuildArch: noarch @@ -285,6 +288,9 @@ install -Dpm 0644 licenses/* -t %{buildroot}%{_pkglicensedir} %changelog +* Tue Sep 26 2023 Kevin Fenzi - 2.15.4-2 +- Add patch to fix readfp with python-3.12. Fixes rhbz#2239728 + * Mon Sep 11 2023 Maxwell G - 2.15.4-1 - Update to 2.15.4. Fixes rhbz#2238445.