tools/osbuild-depsolve-dnf: match dnf repo props

Some of the repository properties in the request were named differently
than the equivalent properties in the dnf repository configuration.
This can introduce bugs and confusion.

One such issue already existed with osbuild/images using 'gpgcheck' in
the request, osbuild-depsolve-dnf checking for 'check_gpg', and the dnf
repository configuration property being 'gpgcheck'.  This didn't cause
any bad behaviour because osbuild/images reused the original (internal)
configuration to set the property in stages and depsolving isn't
affected by the value of this property.

Change the request properties to match the dnf repository configuration
to avoid confusion: gpgcheck, repo_gpgcheck, and sslverify.  Users of
osbuild-depsolve-dnf (osbuild/images) should use property names that
match dnf.  Use the same names in the response.

To maintain the same behaviour for SSL verification, a missing sslverify
default to True.  The previous property had the opposite meaning,
ignore_ssl, and defaulted to False.
This commit is contained in:
Achilleas Koutsou 2024-04-09 21:45:45 +02:00 committed by Brian C. Lane
parent 8ddb607f11
commit b05258fa26

View file

@ -107,8 +107,7 @@ class Solver():
else:
raise ValueError("missing either `baseurl`, `metalink`, or `mirrorlist` in repo")
if desc.get("ignoressl", False):
repo.sslverify = False
repo.sslverify = desc.get("sslverify", True)
if "sslcacert" in desc:
repo.sslcacert = desc["sslcacert"]
if "sslclientkey" in desc:
@ -116,10 +115,10 @@ class Solver():
if "sslclientcert" in desc:
repo.sslclientcert = desc["sslclientcert"]
if "check_gpg" in desc:
repo.gpgcheck = desc["check_gpg"]
if "check_repogpg" in desc:
repo.repo_gpgcheck = desc["check_repogpg"]
if "gpgcheck" in desc:
repo.gpgcheck = desc["gpgcheck"]
if "repo_gpgcheck" in desc:
repo.repo_gpgcheck = desc["repo_gpgcheck"]
if "gpgkey" in desc:
repo.gpgkey = [desc["gpgkey"]]
if "gpgkeys" in desc:
@ -295,9 +294,9 @@ class Solver():
"metalink": repo.metalink,
"mirrorlist": repo.mirrorlist,
"gpgcheck": repo.gpgcheck,
"check_repogpg": repo.repo_gpgcheck,
"repo_gpgcheck": repo.repo_gpgcheck,
"gpgkeys": read_keys(repo.gpgkey, root_dir if repo.id not in request_repo_ids else None),
"ignoressl": not bool(repo.sslverify),
"sslverify": bool(repo.sslverify),
"sslcacert": repo.sslcacert,
"sslclientkey": repo.sslclientkey,
"sslclientcert": repo.sslclientcert,