Handle all possible dnf group_install errors

dnf has changed what it will raise when trying to group_install a
nonexistent group, this adds handling for all of them.

Related: rhbz#1947958
This commit is contained in:
Brian C. Lane 2021-10-11 09:57:07 -07:00
parent f693eb8652
commit 900cd436f7
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ log = logging.getLogger("lorax-composer")
from configparser import ConfigParser
import dnf
from dnf.exceptions import MarkingError, CompsError
from glob import glob
import os
import time
@ -235,7 +236,7 @@ def _depsolve(dbo, projects, groups):
for name in groups:
try:
dbo.group_install(name, ["mandatory", "default"])
except dnf.exceptions.MarkingError as e:
except (MarkingError, ValueError, CompsError) as e:
install_errors.append(("Group %s" % (name), str(e)))
for name, version in projects:

View File

@ -219,6 +219,10 @@ class ProjectsTest(unittest.TestCase):
self.assertTrue("ctags" in names) # default package
self.assertFalse("cmake" in names) # optional package
def test_groups_depsolve_error(self):
with self.assertRaises(ProjectsError):
projects_depsolve(self.dbo, [], ["notagroup"])
class ConfigureTest(unittest.TestCase):
@classmethod