diff --git a/.python-ansible-runner.metadata b/.python-ansible-runner.metadata new file mode 100644 index 0000000..501cc7f --- /dev/null +++ b/.python-ansible-runner.metadata @@ -0,0 +1 @@ +53b25c033fc1d719c97d452f8ea34f05b2877a2d SOURCES/ansible-runner-2.4.0.tar.gz diff --git a/SOURCES/0001-Base64IO-set-write-buffer-before-doing-attr-check.patch b/SOURCES/0001-Base64IO-set-write-buffer-before-doing-attr-check.patch new file mode 100644 index 0000000..d546bf1 --- /dev/null +++ b/SOURCES/0001-Base64IO-set-write-buffer-before-doing-attr-check.patch @@ -0,0 +1,49 @@ +From 855dc43e6f22c362a055b306b40cc91b843c7cb3 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Mon, 24 Jun 2024 12:10:47 -0700 +Subject: [PATCH] Base64IO: set write buffer before doing attr check + +TestBase64IO.test_init_fails() fails in current Fedora Rawhide +(with Python 3.13) because pytest complains about an unraisable +exception: + +AttributeError: 'Base64IO' object has no attribute '_Base64IO__write_buffer' + +it seems like we're reaching `close()` (via `__exit__()`, I +guess) even after raising an exception in `__init__()`, and that +causes a problem because we never set `self.__write_buffer` if +the required attrs check fails. + +To solve this, we can just set `self.__write_buffer` before doing +the attr check. + +Signed-off-by: Adam Williamson +--- + src/ansible_runner/utils/base64io.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/ansible_runner/utils/base64io.py b/src/ansible_runner/utils/base64io.py +index 0a2422f..d9cf927 100644 +--- a/src/ansible_runner/utils/base64io.py ++++ b/src/ansible_runner/utils/base64io.py +@@ -78,6 +78,9 @@ class Base64IO(io.IOBase): + + :raises TypeError: if ``wrapped`` does not have attributes needed to determine the stream's state + """ ++ # set before the attr check as we may reach close() after that ++ # check fails ++ self.__write_buffer = b"" + required_attrs = ("read", "write", "close", "closed", "flush") + if not all(hasattr(wrapped, attr) for attr in required_attrs): + raise TypeError( +@@ -86,7 +89,6 @@ class Base64IO(io.IOBase): + super().__init__() + self.__wrapped = wrapped + self.__read_buffer = b"" +- self.__write_buffer = b"" + + def __enter__(self): + """Return self on enter.""" +-- +2.45.2 + diff --git a/SOURCES/Fix-test-for-get_role_list.patch b/SOURCES/Fix-test-for-get_role_list.patch new file mode 100644 index 0000000..630c076 --- /dev/null +++ b/SOURCES/Fix-test-for-get_role_list.patch @@ -0,0 +1,40 @@ +From dcb68a7011d3b34ee8ca16fb9babe7278f943a16 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 5 Jun 2024 12:00:18 +0200 +Subject: [PATCH] Fix test for get_role_list + +--- + test/integration/test_interface.py | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/test/integration/test_interface.py b/test/integration/test_interface.py +index 457ea71..fecbc61 100644 +--- a/test/integration/test_interface.py ++++ b/test/integration/test_interface.py +@@ -444,11 +444,8 @@ def test_get_role_list(project_fixtures, skipif_pre_ansible211): + containing our test role. + """ + pdir = str(project_fixtures / 'music' / 'project') +- expected_role = { +- "collection": "", +- "entry_points": { +- "main": "The main entry point for the Into_The_Mystic role." +- } ++ expected = { ++ "main": "The main entry point for the Into_The_Mystic role." + } + + resp, _ = get_role_list(playbook_dir=pdir) +@@ -457,7 +454,8 @@ def test_get_role_list(project_fixtures, skipif_pre_ansible211): + # So that tests can work locally, where multiple roles might be returned, + # we check for this single role. + assert 'Into_The_Mystic' in resp +- assert resp['Into_The_Mystic'] == expected_role ++ assert 'entry_points' in resp['Into_The_Mystic'] ++ assert resp['Into_The_Mystic']['entry_points'] == expected + + + @pytest.mark.test_all_runtimes +-- +2.44.0 + diff --git a/SPECS/python-ansible-runner.spec b/SPECS/python-ansible-runner.spec new file mode 100644 index 0000000..ec2bacb --- /dev/null +++ b/SPECS/python-ansible-runner.spec @@ -0,0 +1,308 @@ +# Created by pyp2rpm-3.2.2 +%global pypi_name ansible-runner + +Name: python-%{pypi_name} +Version: 2.4.0 +Release: 7%{?dist} +Summary: A tool and python library to interface with Ansible + +# Automatically converted from old format: ASL 2.0 - review is highly recommended. +License: Apache-2.0 +URL: https://github.com/ansible/ansible-runner +Source0: https://github.com/ansible/%{pypi_name}/archive/%{version}/%{pypi_name}-%{version}.tar.gz +# https://github.com/ansible/ansible-runner/pull/1377 +# Fix a test failure with Python 3.13(?) +Patch: 0001-Base64IO-set-write-buffer-before-doing-attr-check.patch + +# Compatibility with pytest 8 +# https://github.com/ansible/ansible-runner/commit/877a4f16.patch +Patch: Fix-test-for-get_role_list.patch + +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: ansible-core +BuildRequires: python3dist(pbr) +BuildRequires: python3dist(pip) +BuildRequires: python3dist(psutil) +BuildRequires: python3dist(pexpect) >= 4.6 +BuildRequires: python3dist(pytest) +BuildRequires: python3dist(pytest-mock) +BuildRequires: python3dist(pytest-timeout) +BuildRequires: python3dist(pytest-xdist) +BuildRequires: python3dist(pyyaml) +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(six) +BuildRequires: python3dist(python-daemon) +BuildRequires: python3dist(wheel) + +Requires: (ansible-core or ansible) + +%description +Ansible Runner is a tool and python library that helps when interfacing with +Ansible from other systems whether through a container image interface, as a +standalone tool, or imported into a python project. + +%package -n python3-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pypi_name}} + +%description -n python3-%{pypi_name} +Ansible Runner is a tool and python library that helps when interfacing with +Ansible from other systems whether through a container image interface, as a +standalone tool, or imported into a python project. + +%prep +%autosetup -n %{pypi_name}-%{version} -p1 +# Allow the version of setuptools that's in fedora +sed -i 's/, <=[0-9.]*//g' pyproject.toml + +# Allow the version of setuptools-scm that's in fedora +sed -i 's/, <=8.0.4//' pyproject.toml + +sed -i '166 i \@pytest.mark.skip(reason="can not resolve example.com in build system")' test/integration/test_display_callback.py +sed -i '/test_resolved_actions/i \@pytest.mark.skip(reason="ansible version lookup is blank in build")' test/integration/test_display_callback.py +# there's a locale issue with ansible that makes these tests fail. +sed -i '/^def test_worker_without_delete_no_dir.*/i @pytest.skip("Ansible could not initialize the preferred locale: unsupported locale setting", allow_module_level=True)' test/integration/test_transmit_worker_process.py +sed -i '/^def test_worker_without_delete_dir_exists.*/i @pytest.skip("Ansible could not initialize the preferred locale: unsupported locale setting", allow_module_level=True)' test/integration/test_transmit_worker_process.py +sed -i '/^def test_worker_delete_no_dir.*/i @pytest.skip("Ansible could not initialize the preferred locale: unsupported locale setting", allow_module_level=True)' test/integration/test_transmit_worker_process.py +sed -i '/^def test_worker_delete_dir_exists.*/i @pytest.skip("Ansible could not initialize the preferred locale: unsupported locale setting", allow_module_level=True)' test/integration/test_transmit_worker_process.py +# Syntax error upstream with this test, still fails after fixing so skip for now +sed -i '/^def test_dump_artifacts_inventory_object.*/i @pytest.mark.skip("syntax error upstream")' test/unit/utils/test_dump_artifacts.py +# Deprecation Warning from datetime.utcnow() +sed -i '/^def test_no_ResourceWarning_error.*/i @pytest.mark.skip("DeprecationWarning: datetime.utcnow() is deprecated ")' test/unit/test_runner.py + +%generate_buildrequires +export PBR_VERSION=%{version} +%pyproject_buildrequires + +%build +export PBR_VERSION=%{version} +%pyproject_wheel + +%install +export PBR_VERSION=%{version} +%pyproject_install +cp %{buildroot}/%{_bindir}/ansible-runner %{buildroot}/%{_bindir}/ansible-runner-%{python3_version} +ln -s ansible-runner-%{python3_version} %{buildroot}/%{_bindir}/ansible-runner-3 + +%check +# test suite hangs indefinitely on exit without -n auto +# note this implies the dep on xdist, so don't remove it +# https://github.com/ansible/ansible-runner/issues/1369 +%pytest -n auto + +%files -n python3-%{pypi_name} +%license LICENSE.md +%doc README.md +%{_bindir}/ansible-runner-3 +%{_bindir}/ansible-runner-%{python3_version} +%{python3_sitelib}/ansible_runner +%{python3_sitelib}/ansible_runner-%{version}.dist-info +%{_bindir}/ansible-runner + +%changelog +* Sat Jan 18 2025 Fedora Release Engineering - 2.4.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Tue Sep 17 2024 Tomáš Hrnčiar - 2.4.0-6 +- Bump setuptools and setuptools_scm + +* Fri Aug 02 2024 Tomáš Hrnčiar - 2.4.0-5 +- Backport upstream patch needed for compatibility with pytest 8 + +* Wed Jul 24 2024 Miroslav Suchý - 2.4.0-4 +- convert license to SPDX + +* Fri Jul 19 2024 Fedora Release Engineering - 2.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Mon Jun 24 2024 Adam Williamson - 2.4.0-2 +- Backport PR #1377 to fix tests with Python 3.13 +- Run tests with -n auto to avoid hang (GH #1369) +- Rebuilt for Python 3.13 + +* Wed May 22 2024 Dan radez - 2.4.0-1 +- update to 2.4.0 rhbz#2280913 + +* Tue Apr 02 2024 Dan Radez - 2.3.6-1 +- update to 2.3.6 rhbz#2269289 + +* Mon Feb 19 2024 Dan Radez - 2.3.5-1 +- update to 2.3.5 rhbz#2264323 + +* Fri Jan 26 2024 Fedora Release Engineering - 2.3.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 2.3.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 13 2024 Maxwell G - 2.3.4-2 +- Remove unused python3-mock dependency + +* Fri Sep 08 2023 Dan Radez - 2.3.4-1 +- update to 2.3.4 rhbz#2236131 + +* Thu Jul 27 2023 Dan Radez - 2.3.3-4 +- skipping 2 tests to fix build. rhbz#2226145 + +* Fri Jul 21 2023 Fedora Release Engineering - 2.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jun 28 2023 Python Maint - 2.3.3-2 +- Rebuilt for Python 3.12 + +* Mon Jun 19 2023 Dan Radez - 2.3.3-1 +- update to 2.3.3 rhbz#2211436 + +* Fri Jun 16 2023 Python Maint - 2.3.2-2 +- Rebuilt for Python 3.12 + +* Fri Mar 24 2023 Dan Radez - 2.3.2-1 +- update to 2.3.2 rhbz#2174741 + +* Fri Jan 20 2023 Fedora Release Engineering - 2.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Nov 23 2022 Dan Radez - 2.3.1-1 +- update to 2.3.1 (rhbz#2139251) + +* Fri Jul 22 2022 Fedora Release Engineering - 2.2.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jul 19 2022 Dan Radez - 2.2.1-1 +- update to 2.2.1 + +* Thu Jun 16 2022 Python Maint - 2.1.3-4 +- Rebuilt for Python 3.11 + +* Tue Apr 12 2022 Dan Radez - 2.1.3-3 +- updating to use pyproject macros + +* Mon Apr 11 2022 Maxwell G - 2.1.3-2 +- Allow users to choose between ansible and ansible-core. +- Switch BR from ansible to ansible-core. +- Use relative symlinks. + +* Thu Mar 24 2022 Dan Radez - 2.1.3-1 +- Update to 2.1.3 + +* Tue Feb 08 2022 Dan Radez - 2.1.1-3 +- Don't remove egginfo + +* Fri Jan 21 2022 Fedora Release Engineering - 2.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Wed Dec 15 2021 Dan Radez - 2.1.1-1 +- updating to version 2.1.1 + +* Tue Dec 14 2021 Dan Radez - 2.0.0a1-4 +- remove the test module from packaged files + +* Fri Jul 23 2021 Fedora Release Engineering - 2.0.0a1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 2.0.0a1-2 +- Rebuilt for Python 3.10 + +* Fri Apr 30 2021 Dan Radez - 2.0.0a1 +- updating to version 2.0.0a1 + +* Wed Jan 27 2021 Fedora Release Engineering - 1.4.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 1.4.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue May 26 2020 Miro Hrončok - 1.4.6-2 +- Rebuilt for Python 3.9 + +* Thu May 07 2020 Dan Radez - 1.4.6-1 +- updating to version 1.4.6 + +* Tue Mar 24 2020 Dan Radez - 1.4.5-1 +- updating to version 1.4.5 + +* Wed Dec 04 2019 Yatin Karel - 1.4.4-2 +- Drop dependency on tox + +* Tue Nov 05 2019 Dan Radez - 1.4.4-1 +- updating to version 1.4.4 + +* Wed Oct 09 2019 Dan Radez - 1.4.2-1 +- Updating to version 1.4.2 + +* Tue Oct 08 2019 Dan Radez - 1.4.0-1 +- Updating to version 1.4.0 + +* Thu Oct 03 2019 Miro Hrončok - 1.3.4-4 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 1.3.4-3 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 1.3.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Apr 30 2019 Dan Radez - 1.3.4-1 +- Updating to version 1.3.4 + +* Mon Apr 22 2019 Dan Radez - 1.3.3-1 +- Updating to version 1.3.3 + +* Wed Apr 10 2019 Dan Radez - 1.3.2-1 +- Updating to version 1.3.2 + +* Wed Mar 20 2019 Dan Radez - 1.3.0-1 +- Updating to version 1.3 + +* Wed Feb 13 2019 Yatin Karel - 1.2.0-2 +- Enable python2 build for CentOS <= 7 + +* Mon Feb 04 2019 Dan Radez - 1.2.0-1 +- Updating to version 1.2 +- removing python 2 from the spec for F30 + +* Sat Feb 02 2019 Fedora Release Engineering - 1.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Oct 23 2018 Dan Radez - 1.1.2-1 +- Updating to version 1.1.2 + +* Wed Sep 12 2018 Dan Radez - 1.1.0-1 +- Updating to version 1.1.0 + +* Wed Jul 25 2018 Dan Radez - 1.0.5-1 +- Updating to version 1.0.5 + +* Wed Jul 25 2018 Dan Radez - 1.0.4-4 +- 1.0.4 requires pexepct 4.6 + +* Fri Jul 13 2018 Fedora Release Engineering - 1.0.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jul 03 2018 Iryna Shcherbina - 1.0.4-2 +- Fix Python 3 dependency from python2-ansible-runner + +* Mon Jul 02 2018 Dan Radez - 1.0.4-1 +- Updating to version 1.0.4 + +* Tue Jun 19 2018 Miro Hrončok - 1.0.3-4 +- Rebuilt for Python 3.7 + +* Fri Jun 01 2018 Dan Radez - 1.0.3-3 +- skip py3 on non-fedora + +* Thu May 31 2018 Dan Radez - 1.0.3-1 +- Updating to version 1.0.3 + +* Tue May 29 2018 Dan Radez - 1.0.2-1 +- Updating to version 1.0.2 +- Package Requires versions updated +- added py3 support + +* Fri May 11 2018 Dan Radez - 1.0.1-2 +- Adding conditionals so the same spec can be built on fedora and el7 + +* Fri May 04 2018 Dan Radez - 1.0.1-1 +- Initial package. Python 2 support only initially.