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:
parent
f693eb8652
commit
900cd436f7
@ -19,6 +19,7 @@ log = logging.getLogger("lorax-composer")
|
|||||||
|
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
import dnf
|
import dnf
|
||||||
|
from dnf.exceptions import MarkingError, CompsError
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@ -235,7 +236,7 @@ def _depsolve(dbo, projects, groups):
|
|||||||
for name in groups:
|
for name in groups:
|
||||||
try:
|
try:
|
||||||
dbo.group_install(name, ["mandatory", "default"])
|
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)))
|
install_errors.append(("Group %s" % (name), str(e)))
|
||||||
|
|
||||||
for name, version in projects:
|
for name, version in projects:
|
||||||
|
@ -219,6 +219,10 @@ class ProjectsTest(unittest.TestCase):
|
|||||||
self.assertTrue("ctags" in names) # default package
|
self.assertTrue("ctags" in names) # default package
|
||||||
self.assertFalse("cmake" in names) # optional 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):
|
class ConfigureTest(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user