From ffa1e917076c94bf3bbc919038693c6538f641a7 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 9 Apr 2024 22:41:32 +0200 Subject: [PATCH] tools/osbuild-depsolve-dnf5: 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-dnf5 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-dnf5 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. --- tools/osbuild-depsolve-dnf5 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/osbuild-depsolve-dnf5 b/tools/osbuild-depsolve-dnf5 index 40ee4cbf..ff23280f 100755 --- a/tools/osbuild-depsolve-dnf5 +++ b/tools/osbuild-depsolve-dnf5 @@ -218,8 +218,7 @@ class Solver(): else: raise ValueError("missing either `baseurl`, `metalink`, or `mirrorlist` in repo") - if desc.get("ignoressl", False): - conf.sslverify = False + repo.sslverify = desc.get("sslverify", True) if "sslcacert" in desc: conf.sslcacert = desc["sslcacert"] if "sslclientkey" in desc: @@ -227,10 +226,10 @@ class Solver(): if "sslclientcert" in desc: conf.sslclientcert = desc["sslclientcert"] - if "check_gpg" in desc: - conf.gpgcheck = desc["check_gpg"] - if "check_repogpg" in desc: - conf.repo_gpgcheck = desc["check_repogpg"] + if "gpgcheck" in desc: + conf.gpgcheck = desc["gpgcheck"] + if "repo_gpgcheck" in desc: + conf.repo_gpgcheck = desc["repo_gpgcheck"] if "gpgkey" in desc: conf.gpgkey = [desc["gpgkey"]] if "gpgkeys" in desc: @@ -428,7 +427,7 @@ class Solver(): "metalink": get_string_option(repo_cfg.get_metalink_option()), "mirrorlist": get_string_option(repo_cfg.get_mirrorlist_option()), "gpgcheck": repo_cfg.get_gpgcheck_option().get_value(), - "check_repogpg": repo_cfg.get_repo_gpgcheck_option().get_value(), + "repo_gpgcheck": repo_cfg.get_repo_gpgcheck_option().get_value(), "gpgkeys": read_keys(repo_cfg.get_gpgkey_option().get_value(), root_dir if repo.get_id() not in request_repo_ids else None), "sslverify": repo_cfg.get_sslverify_option().get_value(),