mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 16:29:49 +08:00
Use RuntimeError instead of ValueError when the retrieval of default modules fails
This will result in the error actually being in the state reason of the failed module build instead of "An unknown error occurred while validating the modulemd".
This commit is contained in:
@@ -121,7 +121,7 @@ def _get_default_modules(stream, default_modules_scm_url):
|
||||
:return: a dictionary where the keys are default module names and the values are default module
|
||||
streams
|
||||
:rtype: dict
|
||||
:raise ValueError: if no default modules can be retrieved for that stream
|
||||
:raise RuntimeError: if no default modules can be retrieved for that stream
|
||||
"""
|
||||
scm_obj = scm.SCM(default_modules_scm_url)
|
||||
temp_dir = tempfile.mkdtemp()
|
||||
@@ -167,7 +167,7 @@ def _get_default_modules(stream, default_modules_scm_url):
|
||||
except: # noqa: E722
|
||||
msg = "Failed to retrieve the default modules"
|
||||
log.exception(msg)
|
||||
raise ValueError(msg)
|
||||
raise RuntimeError(msg)
|
||||
finally:
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ def test_get_default_modules_invalid_branch(
|
||||
else:
|
||||
mock_get_rawhide.return_value = "something_else"
|
||||
|
||||
with pytest.raises(ValueError, match="Failed to retrieve the default modules"):
|
||||
with pytest.raises(RuntimeError, match="Failed to retrieve the default modules"):
|
||||
default_modules._get_default_modules("f32", conf.default_modules_scm_url)
|
||||
|
||||
mock_mmd_new.assert_not_called()
|
||||
|
||||
Reference in New Issue
Block a user