1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Avoid using deprecated group_install API

DNF's base.group_install() function accepts a string as its first
argument.  Prior to DNF-2, compatibility code existed which allowed this
function to accept a base.comps.Group object instead.  That is no longer
possible.

Pass "group.id" to base.group_install() instead of "group" to work
around this.
This commit is contained in:
Jason Tibbitts 2017-07-25 17:01:51 -05:00 committed by Toshio Kuratomi
parent 9f13951d1b
commit ccce74cf7b

View file

@ -375,7 +375,7 @@ def ensure(module, base, state, names, autoremove):
# Install groups.
for group in groups:
try:
base.group_install(group, dnf.const.GROUP_PACKAGE_TYPES)
base.group_install(group.id, dnf.const.GROUP_PACKAGE_TYPES)
except dnf.exceptions.Error as e:
# In dnf 2.0 if all the mandatory packages in a group do
# not install, an error is raised. We want to capture
@ -402,7 +402,7 @@ def ensure(module, base, state, names, autoremove):
base.group_upgrade(group)
except dnf.exceptions.CompsError:
# If not already installed, try to install.
base.group_install(group, dnf.const.GROUP_PACKAGE_TYPES)
base.group_install(group.id, dnf.const.GROUP_PACKAGE_TYPES)
except dnf.exceptions.Error as e:
failures.append((group, e))