tools/osbuild-depsolve-dnf(5): require releasever

Originally, I made releasever required only when root_dir was set.  This
was initially done to maintain backwards compatibility but we broke that
already and osbuild/images will always include releasever in the
request.
This commit is contained in:
Achilleas Koutsou 2024-04-11 14:59:58 +02:00
parent 0ef3459155
commit 2b2a560aca
2 changed files with 11 additions and 24 deletions

View file

@ -63,8 +63,7 @@ class Solver():
self.base.conf.cachedir = cache_dir
self.base.conf.substitutions['arch'] = arch
self.base.conf.substitutions['basearch'] = dnf.rpm.basearch(arch)
if releasever:
self.base.conf.substitutions['releasever'] = releasever
self.base.conf.substitutions['releasever'] = releasever
if proxy:
self.base.conf.proxy = proxy
@ -445,7 +444,11 @@ def validate_request(request):
"kind": "InvalidRequest",
"reason": "no 'module_platform_id' specified"
}
if not request.get("releasever"):
return {
"kind": "InvalidRequest",
"reason": "no 'module_platform_id' specified"
}
arguments = request.get("arguments")
if not arguments:
return {
@ -459,16 +462,6 @@ def validate_request(request):
"reason": "no 'repos' or 'root_dir' specified"
}
# if root_dir is used, we also need releasever
# pylint: disable=fixme
# TODO: Make releasever mandatory in all cases.
# We temporarily keep it tied to root_dir for short-term backwards compatibility
if arguments.get("root_dir") and not request.get("releasever"):
return {
"kind": "InvalidRequest",
"reason": "'root_dir' requires setting 'releasever'"
}
return None

View file

@ -570,7 +570,11 @@ def validate_request(request):
"kind": "InvalidRequest",
"reason": "no 'module_platform_id' specified"
}
if not request.get("releasever"):
return {
"kind": "InvalidRequest",
"reason": "no 'module_platform_id' specified"
}
arguments = request.get("arguments")
if not arguments:
return {
@ -584,16 +588,6 @@ def validate_request(request):
"reason": "no 'repos' or 'root_dir' specified"
}
# if root_dir is used, we also need releasever
# pylint: disable=fixme
# TODO: Make releasever mandatory in all cases.
# We temporarily keep it tied to root_dir for short-term backwards compatibility
if arguments.get("root_dir") and not request.get("releasever"):
return {
"kind": "InvalidRequest",
"reason": "'root_dir' requires setting 'releasever'"
}
return None