Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
109bec7370 |
||
|
|
e9b83ad6a4 |
||
|
|
76d998ef61 |
8 changed files with 647 additions and 132 deletions
20
.gitignore
vendored
20
.gitignore
vendored
|
|
@ -69,21 +69,5 @@
|
|||
/ansible-documentation-2.16.11.tar.gz
|
||||
/ansible-core-2.16.12.tar.gz
|
||||
/ansible-documentation-2.16.12.tar.gz
|
||||
/ansible-core-2.18.0.tar.gz
|
||||
/ansible-documentation-2.18.0.tar.gz
|
||||
/ansible-core-2.18.1.tar.gz
|
||||
/ansible-documentation-2.18.1.tar.gz
|
||||
/ansible-core-2.18.3.tar.gz
|
||||
/ansible-documentation-2.18.3.tar.gz
|
||||
/ansible-core-2.18.4.tar.gz
|
||||
/ansible-documentation-2.18.4.tar.gz
|
||||
/ansible-core-2.18.6.tar.gz
|
||||
/ansible-documentation-2.18.6.tar.gz
|
||||
/ansible-core-2.18.7.tar.gz
|
||||
/ansible-documentation-2.18.7.tar.gz
|
||||
/ansible-core-2.18.9.tar.gz
|
||||
/ansible-documentation-2.18.9.tar.gz
|
||||
/ansible-core-2.18.11.tar.gz
|
||||
/ansible-documentation-2.18.11.tar.gz
|
||||
/ansible-core-2.20.1.tar.gz
|
||||
/ansible-documentation-2.20.1.tar.gz
|
||||
/ansible-core-2.16.14.tar.gz
|
||||
/ansible-documentation-2.16.14.tar.gz
|
||||
|
|
|
|||
30
.packit.yaml
30
.packit.yaml
|
|
@ -1,30 +0,0 @@
|
|||
# See the documentation for more information:
|
||||
# https://packit.dev/docs/configuration/
|
||||
|
||||
upstream_project_url: https://github.com/ansible/ansible
|
||||
upstream_tag_template: v{version}
|
||||
issue_repository: https://pagure.io/ansible-packit-issues
|
||||
create_sync_note: false
|
||||
# TODO: Remove pending https://fedoraproject.org/wiki/Changes/Ansible13
|
||||
upstream_tag_include: "v2.18"
|
||||
jobs:
|
||||
- job: pull_from_upstream
|
||||
trigger: release
|
||||
dist_git_branches:
|
||||
# Fast forward merge rawhide while it is held at v2.18.
|
||||
rawhide:
|
||||
fast_forward_merge_into:
|
||||
- fedora-43
|
||||
- fedora-42
|
||||
- job: koji_build
|
||||
trigger: commit
|
||||
dist_git_branches:
|
||||
- fedora-all
|
||||
sidetag_group: "ansible"
|
||||
dependents:
|
||||
- ansible
|
||||
# The update for the sidetag group is created in the ansible package.
|
||||
# - job: bodhi_update
|
||||
# trigger: commit
|
||||
# dist_git_branches:
|
||||
# - rawhide
|
||||
107
0001-apt-handle-options-while-installing-python3-apt-8291.patch
Normal file
107
0001-apt-handle-options-while-installing-python3-apt-8291.patch
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
From 47da1bead9ad6d5fbf8e1f9f18d5ea9294342696 Mon Sep 17 00:00:00 2001
|
||||
From: Abhijeet Kasurde <akasurde@redhat.com>
|
||||
Date: Tue, 26 Mar 2024 08:16:27 -0700
|
||||
Subject: [PATCH 1/2] apt: handle options while installing python3-apt (#82913)
|
||||
|
||||
* apt: handle options while installing python3-apt
|
||||
|
||||
* While installing python3-apt library, honor parameter
|
||||
such as install_recommends and dpkg_options
|
||||
|
||||
Fixes: #40608
|
||||
|
||||
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
||||
|
||||
* Review changes
|
||||
|
||||
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
||||
|
||||
---------
|
||||
|
||||
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
|
||||
(cherry picked from commit 8fec1575e63b259311de1fa3505769eeb4696665)
|
||||
---
|
||||
changelogs/fragments/apt_install.yml | 3 +++
|
||||
lib/ansible/modules/apt.py | 30 ++++++++++++++++++----------
|
||||
2 files changed, 22 insertions(+), 11 deletions(-)
|
||||
create mode 100644 changelogs/fragments/apt_install.yml
|
||||
|
||||
diff --git a/changelogs/fragments/apt_install.yml b/changelogs/fragments/apt_install.yml
|
||||
new file mode 100644
|
||||
index 0000000000..84dfaed78a
|
||||
--- /dev/null
|
||||
+++ b/changelogs/fragments/apt_install.yml
|
||||
@@ -0,0 +1,3 @@
|
||||
+---
|
||||
+bugfixes:
|
||||
+ - apt - honor install_recommends and dpkg_options while installing python3-apt library (https://github.com/ansible/ansible/issues/40608).
|
||||
diff --git a/lib/ansible/modules/apt.py b/lib/ansible/modules/apt.py
|
||||
index 336eadde54..8eca4decb2 100644
|
||||
--- a/lib/ansible/modules/apt.py
|
||||
+++ b/lib/ansible/modules/apt.py
|
||||
@@ -1246,6 +1246,15 @@ def main():
|
||||
)
|
||||
module.run_command_environ_update = APT_ENV_VARS
|
||||
|
||||
+ global APTITUDE_CMD
|
||||
+ APTITUDE_CMD = module.get_bin_path("aptitude", False)
|
||||
+ global APT_GET_CMD
|
||||
+ APT_GET_CMD = module.get_bin_path("apt-get")
|
||||
+
|
||||
+ p = module.params
|
||||
+ install_recommends = p['install_recommends']
|
||||
+ dpkg_options = expand_dpkg_options(p['dpkg_options'])
|
||||
+
|
||||
if not HAS_PYTHON_APT:
|
||||
# This interpreter can't see the apt Python library- we'll do the following to try and fix that:
|
||||
# 1) look in common locations for system-owned interpreters that can see it; if we find one, respawn under it
|
||||
@@ -1284,10 +1293,18 @@ def main():
|
||||
module.warn("Auto-installing missing dependency without updating cache: %s" % apt_pkg_name)
|
||||
else:
|
||||
module.warn("Updating cache and auto-installing missing dependency: %s" % apt_pkg_name)
|
||||
- module.run_command(['apt-get', 'update'], check_rc=True)
|
||||
+ module.run_command([APT_GET_CMD, 'update'], check_rc=True)
|
||||
|
||||
# try to install the apt Python binding
|
||||
- module.run_command(['apt-get', 'install', '--no-install-recommends', apt_pkg_name, '-y', '-q'], check_rc=True)
|
||||
+ apt_pkg_cmd = [APT_GET_CMD, 'install', apt_pkg_name, '-y', '-q', dpkg_options]
|
||||
+
|
||||
+ if install_recommends is False:
|
||||
+ apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=no"])
|
||||
+ elif install_recommends is True:
|
||||
+ apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=yes"])
|
||||
+ # install_recommends is None uses the OS default
|
||||
+
|
||||
+ module.run_command(apt_pkg_cmd, check_rc=True)
|
||||
|
||||
# try again to find the bindings in common places
|
||||
interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
||||
@@ -1301,13 +1318,6 @@ def main():
|
||||
# we've done all we can do; just tell the user it's busted and get out
|
||||
module.fail_json(msg="{0} must be installed and visible from {1}.".format(apt_pkg_name, sys.executable))
|
||||
|
||||
- global APTITUDE_CMD
|
||||
- APTITUDE_CMD = module.get_bin_path("aptitude", False)
|
||||
- global APT_GET_CMD
|
||||
- APT_GET_CMD = module.get_bin_path("apt-get")
|
||||
-
|
||||
- p = module.params
|
||||
-
|
||||
if p['clean'] is True:
|
||||
aptclean_stdout, aptclean_stderr, aptclean_diff = aptclean(module)
|
||||
# If there is nothing else to do exit. This will set state as
|
||||
@@ -1331,11 +1341,9 @@ def main():
|
||||
|
||||
updated_cache = False
|
||||
updated_cache_time = 0
|
||||
- install_recommends = p['install_recommends']
|
||||
allow_unauthenticated = p['allow_unauthenticated']
|
||||
allow_downgrade = p['allow_downgrade']
|
||||
allow_change_held_packages = p['allow_change_held_packages']
|
||||
- dpkg_options = expand_dpkg_options(p['dpkg_options'])
|
||||
autoremove = p['autoremove']
|
||||
fail_on_autoremove = p['fail_on_autoremove']
|
||||
autoclean = p['autoclean']
|
||||
--
|
||||
2.47.0
|
||||
|
||||
324
0002-dnf5-apt-add-auto_install_module_deps-option-84292.patch
Normal file
324
0002-dnf5-apt-add-auto_install_module_deps-option-84292.patch
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
From ad10b351811dfe4d98a4f7c50f219495c7d17285 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Krizek <martin.krizek@gmail.com>
|
||||
Date: Thu, 21 Nov 2024 17:06:18 +0100
|
||||
Subject: [PATCH 2/2] dnf5,apt: add auto_install_module_deps option (#84292)
|
||||
|
||||
* dnf5,apt: add auto_install_module_deps option
|
||||
|
||||
Fixes #84206
|
||||
|
||||
(cherry picked from commit 2a53b851fee8ebaa07c1341122dd905354659237)
|
||||
---
|
||||
...4206-dnf5-apt-auto-install-module-deps.yml | 2 +
|
||||
lib/ansible/modules/apt.py | 84 +++++++++++--------
|
||||
lib/ansible/modules/dnf5.py | 52 +++++++++---
|
||||
test/integration/targets/apt/tasks/apt.yml | 28 +++++--
|
||||
test/integration/targets/dnf5/playbook.yml | 17 +++-
|
||||
5 files changed, 128 insertions(+), 55 deletions(-)
|
||||
create mode 100644 changelogs/fragments/84206-dnf5-apt-auto-install-module-deps.yml
|
||||
|
||||
diff --git a/changelogs/fragments/84206-dnf5-apt-auto-install-module-deps.yml b/changelogs/fragments/84206-dnf5-apt-auto-install-module-deps.yml
|
||||
new file mode 100644
|
||||
index 0000000000..14d595449c
|
||||
--- /dev/null
|
||||
+++ b/changelogs/fragments/84206-dnf5-apt-auto-install-module-deps.yml
|
||||
@@ -0,0 +1,2 @@
|
||||
+minor_changes:
|
||||
+ - dnf5, apt - add ``auto_install_module_deps`` option (https://github.com/ansible/ansible/issues/84206)
|
||||
diff --git a/lib/ansible/modules/apt.py b/lib/ansible/modules/apt.py
|
||||
index 8eca4decb2..eab58b82ee 100644
|
||||
--- a/lib/ansible/modules/apt.py
|
||||
+++ b/lib/ansible/modules/apt.py
|
||||
@@ -18,6 +18,12 @@ description:
|
||||
- Manages I(apt) packages (such as for Debian/Ubuntu).
|
||||
version_added: "0.0.2"
|
||||
options:
|
||||
+ auto_install_module_deps:
|
||||
+ description:
|
||||
+ - Automatically install dependencies required to run this module.
|
||||
+ type: bool
|
||||
+ default: yes
|
||||
+ version_added: 2.19
|
||||
name:
|
||||
description:
|
||||
- A list of package names, like V(foo), or package specifier with version, like V(foo=1.0) or V(foo>=1.0).
|
||||
@@ -214,6 +220,9 @@ notes:
|
||||
- When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly to the O(name) option.
|
||||
- When O(default_release) is used, an implicit priority of 990 is used. This is the same behavior as C(apt-get -t).
|
||||
- When an exact version is specified, an implicit priority of 1001 is used.
|
||||
+ - If the interpreter can't import C(python3-apt) the module will check for it in system-owned interpreters as well.
|
||||
+ If the dependency can't be found, depending on the value of O(auto_install_module_deps) the module will attempt to install it.
|
||||
+ If the dependency is found or installed, the module will be respawned under the correct interpreter.
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
@@ -1224,6 +1233,7 @@ def main():
|
||||
allow_downgrade=dict(type='bool', default=False, aliases=['allow-downgrade', 'allow_downgrades', 'allow-downgrades']),
|
||||
allow_change_held_packages=dict(type='bool', default=False),
|
||||
lock_timeout=dict(type='int', default=60),
|
||||
+ auto_install_module_deps=dict(type='bool', default=True),
|
||||
),
|
||||
mutually_exclusive=[['deb', 'package', 'upgrade']],
|
||||
required_one_of=[['autoremove', 'deb', 'package', 'update_cache', 'upgrade']],
|
||||
@@ -1284,39 +1294,47 @@ def main():
|
||||
|
||||
# don't make changes if we're in check_mode
|
||||
if module.check_mode:
|
||||
- module.fail_json(msg="%s must be installed to use check mode. "
|
||||
- "If run normally this module can auto-install it." % apt_pkg_name)
|
||||
-
|
||||
- # We skip cache update in auto install the dependency if the
|
||||
- # user explicitly declared it with update_cache=no.
|
||||
- if module.params.get('update_cache') is False:
|
||||
- module.warn("Auto-installing missing dependency without updating cache: %s" % apt_pkg_name)
|
||||
- else:
|
||||
- module.warn("Updating cache and auto-installing missing dependency: %s" % apt_pkg_name)
|
||||
- module.run_command([APT_GET_CMD, 'update'], check_rc=True)
|
||||
-
|
||||
- # try to install the apt Python binding
|
||||
- apt_pkg_cmd = [APT_GET_CMD, 'install', apt_pkg_name, '-y', '-q', dpkg_options]
|
||||
-
|
||||
- if install_recommends is False:
|
||||
- apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=no"])
|
||||
- elif install_recommends is True:
|
||||
- apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=yes"])
|
||||
- # install_recommends is None uses the OS default
|
||||
-
|
||||
- module.run_command(apt_pkg_cmd, check_rc=True)
|
||||
-
|
||||
- # try again to find the bindings in common places
|
||||
- interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
||||
-
|
||||
- if interpreter:
|
||||
- # found the Python bindings; respawn this module under the interpreter where we found them
|
||||
- # NB: respawn is somewhat wasteful if it's this interpreter, but simplifies the code
|
||||
- respawn_module(interpreter)
|
||||
- # this is the end of the line for this process, it will exit here once the respawned module has completed
|
||||
- else:
|
||||
- # we've done all we can do; just tell the user it's busted and get out
|
||||
- module.fail_json(msg="{0} must be installed and visible from {1}.".format(apt_pkg_name, sys.executable))
|
||||
+ module.fail_json(
|
||||
+ msg=f"{apt_pkg_name} must be installed to use check mode. "
|
||||
+ "If run normally this module can auto-install it, "
|
||||
+ "see the auto_install_module_deps option.",
|
||||
+ )
|
||||
+ elif p['auto_install_module_deps']:
|
||||
+ # We skip cache update in auto install the dependency if the
|
||||
+ # user explicitly declared it with update_cache=no.
|
||||
+ if module.params.get('update_cache') is False:
|
||||
+ module.warn("Auto-installing missing dependency without updating cache: %s" % apt_pkg_name)
|
||||
+ else:
|
||||
+ module.warn("Updating cache and auto-installing missing dependency: %s" % apt_pkg_name)
|
||||
+ module.run_command([APT_GET_CMD, 'update'], check_rc=True)
|
||||
+
|
||||
+ # try to install the apt Python binding
|
||||
+ apt_pkg_cmd = [APT_GET_CMD, 'install', apt_pkg_name, '-y', '-q', dpkg_options]
|
||||
+
|
||||
+ if install_recommends is False:
|
||||
+ apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=no"])
|
||||
+ elif install_recommends is True:
|
||||
+ apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=yes"])
|
||||
+ # install_recommends is None uses the OS default
|
||||
+
|
||||
+ module.run_command(apt_pkg_cmd, check_rc=True)
|
||||
+
|
||||
+ # try again to find the bindings in common places
|
||||
+ interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
||||
+
|
||||
+ if interpreter:
|
||||
+ # found the Python bindings; respawn this module under the interpreter where we found them
|
||||
+ # NB: respawn is somewhat wasteful if it's this interpreter, but simplifies the code
|
||||
+ respawn_module(interpreter)
|
||||
+ # this is the end of the line for this process, it will exit here once the respawned module has completed
|
||||
+
|
||||
+ # we've done all we can do; just tell the user it's busted and get out
|
||||
+ py_version = sys.version.replace("\n", "")
|
||||
+ module.fail_json(
|
||||
+ msg=f"Could not import the {apt_pkg_name} module using {sys.executable} ({py_version}). "
|
||||
+ f"Ensure {apt_pkg_name} package is installed (either manually or via the auto_install_module_deps option) "
|
||||
+ f"or that you have specified the correct ansible_python_interpreter. (attempted {interpreters}).",
|
||||
+ )
|
||||
|
||||
if p['clean'] is True:
|
||||
aptclean_stdout, aptclean_stderr, aptclean_diff = aptclean(module)
|
||||
diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py
|
||||
index 160676a828..335786328f 100644
|
||||
--- a/lib/ansible/modules/dnf5.py
|
||||
+++ b/lib/ansible/modules/dnf5.py
|
||||
@@ -15,6 +15,12 @@ description:
|
||||
provides are implemented in M(ansible.builtin.dnf5), please consult specific options for more information."
|
||||
short_description: Manages packages with the I(dnf5) package manager
|
||||
options:
|
||||
+ auto_install_module_deps:
|
||||
+ description:
|
||||
+ - Automatically install dependencies required to run this module.
|
||||
+ type: bool
|
||||
+ default: yes
|
||||
+ version_added: 2.19
|
||||
name:
|
||||
description:
|
||||
- "A package name or package specifier with version, like C(name-1.0).
|
||||
@@ -238,6 +244,10 @@ attributes:
|
||||
requirements:
|
||||
- "python3"
|
||||
- "python3-libdnf5"
|
||||
+notes:
|
||||
+ - If the interpreter can't import C(python3-libdnf5) the module will check for it in system-owned interpreters as well.
|
||||
+ If the dependency can't be found, depending on the value of O(auto_install_module_deps) the module will attempt to install it.
|
||||
+ If the dependency is found or installed, the module will be respawned under the correct interpreter.
|
||||
version_added: 2.15
|
||||
"""
|
||||
|
||||
@@ -432,6 +442,8 @@ def get_unneeded_pkgs(base):
|
||||
class Dnf5Module(YumDnf):
|
||||
def __init__(self, module):
|
||||
super(Dnf5Module, self).__init__(module)
|
||||
+ self.auto_install_module_deps = self.module.params["auto_install_module_deps"]
|
||||
+
|
||||
self._ensure_dnf()
|
||||
|
||||
# FIXME https://github.com/rpm-software-management/dnf5/issues/402
|
||||
@@ -465,21 +477,30 @@ class Dnf5Module(YumDnf):
|
||||
]
|
||||
|
||||
if not has_respawned():
|
||||
- # probe well-known system Python locations for accessible bindings, favoring py3
|
||||
- interpreter = probe_interpreters_for_module(system_interpreters, "libdnf5")
|
||||
-
|
||||
- if interpreter:
|
||||
- # respawn under the interpreter where the bindings should be found
|
||||
- respawn_module(interpreter)
|
||||
- # end of the line for this module, the process will exit here once the respawned module completes
|
||||
+ for attempt in (1, 2):
|
||||
+ # probe well-known system Python locations for accessible bindings
|
||||
+ interpreter = probe_interpreters_for_module(system_interpreters, "libdnf5")
|
||||
+ if interpreter:
|
||||
+ # respawn under the interpreter where the bindings should be found
|
||||
+ respawn_module(interpreter)
|
||||
+ # end of the line for this module, the process will exit here once the respawned module completes
|
||||
+ if attempt == 1:
|
||||
+ if self.module.check_mode:
|
||||
+ self.module.fail_json(
|
||||
+ msg="python3-libdnf5 must be installed to use check mode. "
|
||||
+ "If run normally this module can auto-install it, "
|
||||
+ "see the auto_install_module_deps option.",
|
||||
+ )
|
||||
+ elif self.auto_install_module_deps:
|
||||
+ self.module.run_command(["dnf", "install", "-y", "python3-libdnf5"], check_rc=True)
|
||||
+ else:
|
||||
+ break
|
||||
|
||||
- # done all we can do, something is just broken (auto-install isn't useful anymore with respawn, so it was removed)
|
||||
+ py_version = sys.version.replace("\n", "")
|
||||
self.module.fail_json(
|
||||
- msg="Could not import the libdnf5 python module using {0} ({1}). "
|
||||
- "Please install python3-libdnf5 package or ensure you have specified the "
|
||||
- "correct ansible_python_interpreter. (attempted {2})".format(
|
||||
- sys.executable, sys.version.replace("\n", ""), system_interpreters
|
||||
- ),
|
||||
+ msg=f"Could not import the libdnf5 python module using {sys.executable} ({py_version}). "
|
||||
+ "Ensure python3-libdnf5 package is installed (either manually or via the auto_install_module_deps option) "
|
||||
+ f"or that you have specified the correct ansible_python_interpreter. (attempted {system_interpreters}).",
|
||||
failures=[],
|
||||
)
|
||||
|
||||
@@ -735,6 +756,11 @@ def main():
|
||||
# backported to yum because yum is now in "maintenance mode" upstream
|
||||
yumdnf_argument_spec["argument_spec"]["allowerasing"] = dict(default=False, type="bool")
|
||||
yumdnf_argument_spec["argument_spec"]["nobest"] = dict(default=False, type="bool")
|
||||
+ yumdnf_argument_spec["argument_spec"].update(
|
||||
+ dict(
|
||||
+ auto_install_module_deps=dict(type="bool", default=True),
|
||||
+ )
|
||||
+ )
|
||||
Dnf5Module(AnsibleModule(**yumdnf_argument_spec)).run()
|
||||
|
||||
|
||||
diff --git a/test/integration/targets/apt/tasks/apt.yml b/test/integration/targets/apt/tasks/apt.yml
|
||||
index a0bc19929f..c3e198eec1 100644
|
||||
--- a/test/integration/targets/apt/tasks/apt.yml
|
||||
+++ b/test/integration/targets/apt/tasks/apt.yml
|
||||
@@ -8,17 +8,17 @@
|
||||
distro_mirror: http://archive.ubuntu.com/ubuntu
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
-# UNINSTALL 'python-apt'
|
||||
-# The `apt` module has the smarts to auto-install `python-apt(3)`. To test, we
|
||||
-# will first uninstall `python-apt`.
|
||||
-- name: uninstall python-apt with apt
|
||||
+# UNINSTALL 'python3-apt'
|
||||
+# The `apt` module has the smarts to auto-install `python3-apt`. To test, we
|
||||
+# will first uninstall `python3-apt`.
|
||||
+- name: uninstall python3-apt with apt
|
||||
apt:
|
||||
- pkg: [python-apt, python3-apt]
|
||||
+ pkg: python3-apt
|
||||
state: absent
|
||||
purge: yes
|
||||
register: apt_result
|
||||
|
||||
-# In check mode, auto-install of `python-apt` must fail
|
||||
+# In check mode, auto-install of `python3-apt` must fail
|
||||
- name: test fail uninstall hello without required apt deps in check mode
|
||||
apt:
|
||||
pkg: hello
|
||||
@@ -32,13 +32,25 @@
|
||||
assert:
|
||||
that:
|
||||
- apt_result is failed
|
||||
- - '"If run normally this module can auto-install it." in apt_result.msg'
|
||||
+ - '"If run normally this module can auto-install it" in apt_result.msg'
|
||||
|
||||
- name: check with dpkg
|
||||
- shell: dpkg -s python-apt python3-apt
|
||||
+ shell: dpkg -s python3-apt
|
||||
register: dpkg_result
|
||||
ignore_errors: true
|
||||
|
||||
+- name: Test the auto_install_module_deps option
|
||||
+ apt:
|
||||
+ pkg: hello
|
||||
+ auto_install_module_deps: false
|
||||
+ register: r
|
||||
+ ignore_errors: true
|
||||
+
|
||||
+- assert:
|
||||
+ that:
|
||||
+ - r is failed
|
||||
+ - r.msg is contains("Could not import the python3-apt module")
|
||||
+
|
||||
# UNINSTALL 'hello'
|
||||
# With 'python-apt' uninstalled, the first call to 'apt' should install
|
||||
# python-apt without updating the cache.
|
||||
diff --git a/test/integration/targets/dnf5/playbook.yml b/test/integration/targets/dnf5/playbook.yml
|
||||
index 1c1f122ef6..4c2fe6d482 100644
|
||||
--- a/test/integration/targets/dnf5/playbook.yml
|
||||
+++ b/test/integration/targets/dnf5/playbook.yml
|
||||
@@ -1,8 +1,23 @@
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- block:
|
||||
- - command: dnf install -y python3-libdnf5
|
||||
+ - name: Ensure module deps are not installed
|
||||
+ command: dnf remove -y python3-libdnf5
|
||||
|
||||
+ - name: Test the auto_install_module_deps option
|
||||
+ dnf5:
|
||||
+ name: sos
|
||||
+ auto_install_module_deps: false
|
||||
+ register: r
|
||||
+ ignore_errors: true
|
||||
+
|
||||
+ - assert:
|
||||
+ that:
|
||||
+ - r is failed
|
||||
+ - r.msg is contains("Could not import the libdnf5 python module")
|
||||
+
|
||||
+ # Now the first dnf5 task in the dnf role should auto install python3-libdnf5 as
|
||||
+ # auto_install_module_deps is true by default.
|
||||
- include_role:
|
||||
name: dnf
|
||||
vars:
|
||||
--
|
||||
2.47.0
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
From 2a0c1f7bc423541d501c3434a77ba6927cbf40b3 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Martz <matt@sivel.net>
|
||||
Date: Tue, 8 Apr 2025 09:35:32 -0500
|
||||
Subject: [PATCH 3/3] Handle forwarded exceptions from dnf5-5.2.13 (#84933)
|
||||
|
||||
(cherry picked from commit 6a274d84567d824437283b497459de542571d93e)
|
||||
---
|
||||
.../fragments/dnf5-exception-forwarding.yml | 2 ++
|
||||
lib/ansible/modules/dnf5.py | 17 +++++++++++++----
|
||||
2 files changed, 15 insertions(+), 4 deletions(-)
|
||||
create mode 100644 changelogs/fragments/dnf5-exception-forwarding.yml
|
||||
|
||||
diff --git a/changelogs/fragments/dnf5-exception-forwarding.yml b/changelogs/fragments/dnf5-exception-forwarding.yml
|
||||
new file mode 100644
|
||||
index 0000000000..023785ae1f
|
||||
--- /dev/null
|
||||
+++ b/changelogs/fragments/dnf5-exception-forwarding.yml
|
||||
@@ -0,0 +1,2 @@
|
||||
+bugfixes:
|
||||
+- dnf5 - Handle forwarded exceptions from dnf5-5.2.13 where a generic ``RuntimeError`` was previously raised
|
||||
diff --git a/lib/ansible/modules/dnf5.py b/lib/ansible/modules/dnf5.py
|
||||
index 335786328f..fd538f88ee 100644
|
||||
--- a/lib/ansible/modules/dnf5.py
|
||||
+++ b/lib/ansible/modules/dnf5.py
|
||||
@@ -356,6 +356,8 @@ from ansible.module_utils.common.respawn import has_respawned, probe_interpreter
|
||||
from ansible.module_utils.yumdnf import YumDnf, yumdnf_argument_spec
|
||||
|
||||
libdnf5 = None
|
||||
+# Through dnf5-5.2.12 all exceptions raised through swig became RuntimeError
|
||||
+LIBDNF5_ERROR = RuntimeError
|
||||
|
||||
|
||||
def is_installed(base, spec):
|
||||
@@ -382,7 +384,7 @@ def is_installed(base, spec):
|
||||
def is_newer_version_installed(base, spec):
|
||||
try:
|
||||
spec_nevra = next(iter(libdnf5.rpm.Nevra.parse(spec)))
|
||||
- except RuntimeError:
|
||||
+ except (LIBDNF5_ERROR, StopIteration):
|
||||
return False
|
||||
|
||||
spec_version = spec_nevra.get_version()
|
||||
@@ -460,12 +462,19 @@ class Dnf5Module(YumDnf):
|
||||
os.environ["LANGUAGE"] = os.environ["LANG"] = locale
|
||||
|
||||
global libdnf5
|
||||
+ global LIBDNF5_ERROR
|
||||
has_dnf = True
|
||||
try:
|
||||
import libdnf5 # type: ignore[import]
|
||||
except ImportError:
|
||||
has_dnf = False
|
||||
|
||||
+ try:
|
||||
+ import libdnf5.exception # type: ignore[import-not-found]
|
||||
+ LIBDNF5_ERROR = libdnf5.exception.Error
|
||||
+ except (ImportError, AttributeError):
|
||||
+ pass
|
||||
+
|
||||
if has_dnf:
|
||||
return
|
||||
|
||||
@@ -537,7 +546,7 @@ class Dnf5Module(YumDnf):
|
||||
|
||||
try:
|
||||
base.load_config()
|
||||
- except RuntimeError as e:
|
||||
+ except LIBDNF5_ERROR as e:
|
||||
self.module.fail_json(
|
||||
msg=str(e),
|
||||
conf_file=self.conf_file,
|
||||
@@ -671,7 +680,7 @@ class Dnf5Module(YumDnf):
|
||||
for spec in self.names:
|
||||
try:
|
||||
goal.add_remove(spec, settings)
|
||||
- except RuntimeError as e:
|
||||
+ except LIBDNF5_ERROR as e:
|
||||
self.module.fail_json(msg=str(e), failures=[], rc=1)
|
||||
if self.autoremove:
|
||||
for pkg in get_unneeded_pkgs(base):
|
||||
@@ -680,7 +689,7 @@ class Dnf5Module(YumDnf):
|
||||
goal.set_allow_erasing(self.allowerasing)
|
||||
try:
|
||||
transaction = goal.resolve()
|
||||
- except RuntimeError as e:
|
||||
+ except LIBDNF5_ERROR as e:
|
||||
self.module.fail_json(msg=str(e), failures=[], rc=1)
|
||||
|
||||
if transaction.get_problems():
|
||||
--
|
||||
2.49.0
|
||||
|
||||
|
|
@ -12,62 +12,99 @@
|
|||
# disable the python -s shbang flag as we want to be able to find non system modules
|
||||
%undefine _py3_shebang_s
|
||||
|
||||
Name: ansible-core
|
||||
Version: 2.20.1
|
||||
Name: ansible-core
|
||||
Summary: A radically simple IT automation system
|
||||
Version: 2.16.14
|
||||
%global uversion %{version_no_tilde %{quote:%nil}}
|
||||
Release: 2%{?dist}
|
||||
Summary: A radically simple IT automation system
|
||||
|
||||
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.
|
||||
# The ssh-agent helper code is BSD-3-Clause.
|
||||
License: GPL-3.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND PSF-2.0 AND MIT AND Apache-2.0
|
||||
URL: https://ansible.com
|
||||
License: GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
|
||||
|
||||
Source0: https://github.com/ansible/ansible/archive/v%{uversion}/%{name}-%{uversion}.tar.gz
|
||||
Source1: https://github.com/ansible/ansible-documentation/archive/v%{uversion}/ansible-documentation-%{uversion}.tar.gz
|
||||
Source0: https://github.com/ansible/ansible/archive/v%{uversion}/%{name}-%{uversion}.tar.gz
|
||||
Source1: https://github.com/ansible/ansible-documentation/archive/v%{uversion}/ansible-documentation-%{uversion}.tar.gz
|
||||
|
||||
BuildArch: noarch
|
||||
# ansible-core 2.16 does not support Python 3.13 and upstream does not plan to do so until 2.18
|
||||
# This downstream-only patch makes it possible to build 2.16 with Python 3.13
|
||||
Patch: python3.13.patch
|
||||
|
||||
# apt: handle options while installing python3-apt (#82913)
|
||||
# https://github.com/ansible/ansible/pull/82913
|
||||
# This patch is a pre-req for the following patch
|
||||
Patch: 0001-apt-handle-options-while-installing-python3-apt-8291.patch
|
||||
# dnf5,apt: add auto_install_module_deps option (#84292)
|
||||
# https://github.com/ansible/ansible/pull/84292.patch
|
||||
# https://bugzilla.redhat.com/2322751
|
||||
Patch: 0002-dnf5-apt-add-auto_install_module_deps-option-84292.patch
|
||||
# Handle forwarded exceptions from dnf5-5.2.13 (#84933)
|
||||
# https://github.com/ansible/ansible/pull/84933
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2365645
|
||||
Patch: 0003-Handle-forwarded-exceptions-from-dnf5-5.2.13-84933.patch
|
||||
|
||||
Url: https://ansible.com
|
||||
BuildArch: noarch
|
||||
|
||||
# Virtual provides for bundled libraries
|
||||
# Search for `_BUNDLED_METADATA` to find them
|
||||
|
||||
# lib/ansible/module_utils/urls.py
|
||||
# SPDX-License-Identifier: BSD-2-Clause AND PSF-2.0
|
||||
Provides: bundled(python3dist(backports-ssl-match-hostname)) = 3.7.0.1
|
||||
|
||||
# lib/ansible/module_utils/distro/*
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
Provides: bundled(python3dist(distro)) = 1.9.0
|
||||
Provides: bundled(python3dist(distro)) = 1.6.0
|
||||
|
||||
# lib/ansible/module_utils/six/*
|
||||
# SPDX-License-Identifier: MIT
|
||||
Provides: bundled(python3dist(six)) = 1.17.0
|
||||
Provides: bundled(python3dist(six)) = 1.16.0
|
||||
|
||||
# lib/ansible/_internal/_wrapt.py
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
Provides: bundled(python3dist(wrapt)) = 1.17.2
|
||||
# lib/ansible/module_utils/compat/selectors.py
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
Provides: bundled(python3dist(selectors2)) = 1.1.1
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
# lib/ansible/module_utils/compat/ipaddress.py
|
||||
# SPDX-License-Identifier: PSF-2.0
|
||||
Provides: bundled(python3dist(ipaddress)) = 1.0.22
|
||||
|
||||
Conflicts: ansible <= 2.9.99
|
||||
#
|
||||
# obsoletes/provides for ansible-base
|
||||
#
|
||||
Provides: ansible-base = %{version}-%{release}
|
||||
Obsoletes: ansible-base < 2.10.6-1
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
# This is only used in %%prep to relax the required setuptools version,
|
||||
# which is not necessary in RHEL 10+.
|
||||
# Not using it in RHEL avoids unwanted dependencies.
|
||||
%if %{undefined rhel}
|
||||
BuildRequires: tomcli >= 0.3.0
|
||||
BuildRequires: tomcli >= 0.3.0
|
||||
%endif
|
||||
# Needed to build manpages from source.
|
||||
BuildRequires: python%{python3_pkgversion}-docutils
|
||||
BuildRequires: python%{python3_pkgversion}-docutils
|
||||
|
||||
%if %{with tests}
|
||||
BuildRequires: git-core
|
||||
BuildRequires: glibc-all-langpacks
|
||||
BuildRequires: python%{python3_pkgversion}-systemd
|
||||
BuildRequires: git-core
|
||||
BuildRequires: glibc-all-langpacks
|
||||
BuildRequires: python%{python3_pkgversion}-systemd
|
||||
|
||||
%if v"0%{?python3_version}" >= v"3.13"
|
||||
# Use crypt_r on Python 3.13+
|
||||
# https://github.com/ansible/ansible/issues/82758
|
||||
# Upstream has removed the dependency on crypt from ansible 2.17+
|
||||
BuildRequires: python%{python3_pkgversion}-crypt-r
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{with argcomplete}
|
||||
Requires: python%{python3_pkgversion}-argcomplete
|
||||
Requires: python%{python3_pkgversion}-argcomplete
|
||||
%endif
|
||||
%if 0%{?fedora} >= 39
|
||||
BuildRequires: python3-libdnf5
|
||||
Recommends: python3-libdnf5
|
||||
BuildRequires: python3-libdnf5
|
||||
Recommends: python3-libdnf5
|
||||
%endif
|
||||
|
||||
|
||||
|
|
@ -83,9 +120,9 @@ are transferred to managed machines automatically.}
|
|||
This is the base part of ansible (the engine).
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for Ansible Core
|
||||
Provides: ansible-base-doc = %{version}-%{release}
|
||||
Obsoletes: ansible-base-doc < 2.10.6-1
|
||||
Summary: Documentation for Ansible Core
|
||||
Provides: ansible-base-doc = %{version}-%{release}
|
||||
Obsoletes: ansible-base-doc < 2.10.6-1
|
||||
|
||||
%description doc %_description
|
||||
|
||||
|
|
@ -234,8 +271,8 @@ install -Dpm 0644 licenses/* -t %{buildroot}%{_pkglicensedir}
|
|||
|
||||
%files -f %{pyproject_files}
|
||||
%license COPYING
|
||||
%license %{_pkglicensedir}/{Apache-License,MIT-license,PSF-license,simplified_bsd,BSD-3-Clause}.txt
|
||||
%doc README.md changelogs/CHANGELOG-v2.2?.rst
|
||||
%license %{_pkglicensedir}/{Apache-License,MIT-license,PSF-license,simplified_bsd}.txt
|
||||
%doc README.md changelogs/CHANGELOG-v2.1?.rst
|
||||
%dir %{_sysconfdir}/ansible/
|
||||
%config(noreplace) %{_sysconfdir}/ansible/*
|
||||
%{_bindir}/ansible*
|
||||
|
|
@ -254,60 +291,13 @@ install -Dpm 0644 licenses/* -t %{buildroot}%{_pkglicensedir}
|
|||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.20.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||
* Sat Jun 07 2025 Maxwell G <maxwell@gtmx.me> - 2.16.14-2
|
||||
- Backport patch to support libdnf5 5.2.13+ (rhbz#2365689)
|
||||
|
||||
* Tue Dec 09 2025 Maxwell G <maxwell@gtmx.me> - 2.20.1-1
|
||||
- Update to 2.20.1. Fixes rhbz#2382388.
|
||||
- Update bundled() Provides
|
||||
- Remove upstreamed patches
|
||||
- Remove old Provides and Obsoletes for ansible-base and Ansible <= 2.9
|
||||
|
||||
* Mon Nov 17 2025 Packit <hello@packit.dev> - 2.18.11-1
|
||||
- Update to version 2.18.11
|
||||
|
||||
* Sat Sep 27 2025 Maxwell G <maxwell@gtmx.me> - 2.18.9-1
|
||||
- Update to 2.18.9.
|
||||
|
||||
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 2.18.7-4
|
||||
- Rebuilt for Python 3.14.0rc3 bytecode
|
||||
|
||||
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 2.18.7-3
|
||||
- Rebuilt for Python 3.14.0rc2 bytecode
|
||||
|
||||
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.7-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Wed Jul 16 2025 Maxwell G <maxwell@gtmx.me> - 2.18.7-1
|
||||
- Update to 2.18.7. Fixes rhbz#2380244.
|
||||
|
||||
* Sat Jun 07 2025 Maxwell G <maxwell@gtmx.me> - 2.18.6-2
|
||||
- Add initial support for Python 3.14 (rhbz#2366307)
|
||||
|
||||
* Sat Jun 07 2025 Maxwell G <maxwell@gtmx.me> - 2.18.6-1
|
||||
- Update to 2.18.6. Fixes rhbz#2354908.
|
||||
|
||||
* Tue Jun 03 2025 Python Maint <python-maint@redhat.com> - 2.18.4-2
|
||||
- Rebuilt for Python 3.14
|
||||
|
||||
* Tue Mar 25 2025 Packit <hello@packit.dev> - 2.18.4-1
|
||||
- Update to version 2.18.4
|
||||
- Resolves: rhbz#2354908
|
||||
|
||||
* Mon Mar 17 2025 Packit <hello@packit.dev> - 2.18.3-1
|
||||
- Update to version 2.18.3
|
||||
- Resolves: rhbz#2342365
|
||||
|
||||
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.18.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Wed Dec 04 2024 Maxwell G <maxwell@gtmx.me> - 2.18.1-1
|
||||
- Update to 2.18.1. Fixes rhbz#2330005.
|
||||
* Wed Dec 18 2024 Maxwell G <maxwell@gtmx.me> - 2.16.14-1
|
||||
- Update to 2.16.14.
|
||||
- dnf5 - backport support for automatically installing python3-libdnf5 (rhbz#2322751).
|
||||
|
||||
* Tue Nov 26 2024 Maxwell G <maxwell@gtmx.me> - 2.18.0-1
|
||||
- Update to 2.18.0. Fixes rhbz#2282011.
|
||||
|
||||
* Fri Oct 11 2024 Maxwell G <maxwell@gtmx.me> - 2.16.12-1
|
||||
- Update to 2.16.12.
|
||||
|
||||
|
|
|
|||
48
python3.13.patch
Normal file
48
python3.13.patch
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
From 54fc9d327d272c3d1d02a9c44d609a027b67105c Mon Sep 17 00:00:00 2001
|
||||
From: Karolina Surma <ksurma@redhat.com>
|
||||
Date: Thu, 23 May 2024 12:38:22 +0200
|
||||
Subject: [PATCH] Make it possible to build with Python 3.13
|
||||
|
||||
---
|
||||
test/lib/ansible_test/_data/requirements/ansible-test.txt | 2 +-
|
||||
test/lib/ansible_test/_internal/coverage_util.py | 2 +-
|
||||
test/lib/ansible_test/_util/target/common/constants.py | 1 +
|
||||
3 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/lib/ansible_test/_data/requirements/ansible-test.txt b/test/lib/ansible_test/_data/requirements/ansible-test.txt
|
||||
index 17662f0..2b725a9 100644
|
||||
--- a/test/lib/ansible_test/_data/requirements/ansible-test.txt
|
||||
+++ b/test/lib/ansible_test/_data/requirements/ansible-test.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
# The test-constraints sanity test verifies this file, but changes must be made manually to keep it in up-to-date.
|
||||
virtualenv == 16.7.12 ; python_version < '3'
|
||||
-coverage == 7.3.2 ; python_version >= '3.8' and python_version <= '3.12'
|
||||
+coverage == 7.3.2 ; python_version >= '3.8' and python_version <= '3.13'
|
||||
coverage == 6.5.0 ; python_version >= '3.7' and python_version <= '3.7'
|
||||
coverage == 4.5.4 ; python_version >= '2.6' and python_version <= '3.6'
|
||||
diff --git a/test/lib/ansible_test/_internal/coverage_util.py b/test/lib/ansible_test/_internal/coverage_util.py
|
||||
index 3017623..f437110 100644
|
||||
--- a/test/lib/ansible_test/_internal/coverage_util.py
|
||||
+++ b/test/lib/ansible_test/_internal/coverage_util.py
|
||||
@@ -69,7 +69,7 @@ class CoverageVersion:
|
||||
|
||||
COVERAGE_VERSIONS = (
|
||||
# IMPORTANT: Keep this in sync with the ansible-test.txt requirements file.
|
||||
- CoverageVersion('7.3.2', 7, (3, 8), (3, 12)),
|
||||
+ CoverageVersion('7.3.2', 7, (3, 8), (3, 13)),
|
||||
CoverageVersion('6.5.0', 7, (3, 7), (3, 7)),
|
||||
CoverageVersion('4.5.4', 0, (2, 6), (3, 6)),
|
||||
)
|
||||
diff --git a/test/lib/ansible_test/_util/target/common/constants.py b/test/lib/ansible_test/_util/target/common/constants.py
|
||||
index 36a5a2c..db81f6b 100644
|
||||
--- a/test/lib/ansible_test/_util/target/common/constants.py
|
||||
+++ b/test/lib/ansible_test/_util/target/common/constants.py
|
||||
@@ -17,4 +17,5 @@ CONTROLLER_PYTHON_VERSIONS = (
|
||||
'3.10',
|
||||
'3.11',
|
||||
'3.12',
|
||||
+ '3.13',
|
||||
)
|
||||
--
|
||||
2.45.0
|
||||
|
||||
4
sources
4
sources
|
|
@ -1,2 +1,2 @@
|
|||
SHA512 (ansible-core-2.20.1.tar.gz) = fa0a4836e3548cd4e432e87b241beb6fb556765699c25b1f3b1c47111a1c44d5ba3244aeb8793408e72ab63564d6e848148becbfb550bd965e466752d7f78229
|
||||
SHA512 (ansible-documentation-2.20.1.tar.gz) = 0dc20cb62280c715e4b06788a5eb2c757c388d0da646a38fc3ab56e38d236ddb0fd7586a567d973e530ed3ed2310ff26542cdb0e1621e0049147dc747e20205b
|
||||
SHA512 (ansible-core-2.16.14.tar.gz) = 6a375db9481be199b0bd1fd41ffc7631bd69cab1ebdacdb0a41f42cdba60ee4916a3eb4238fd865b5b75f4f32ba42a9ee073d56d6986ce3aecf27bb75f02898c
|
||||
SHA512 (ansible-documentation-2.16.14.tar.gz) = 6241289f243c582701133d3a3add14456e6bccca796fcaae6f5124df8e13027f59563ef745a81581e73b42a12c4af38f1745760759bb4abd7fc6e489c3d9277f
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue