sources: relax "mirror" regexp to follow upstream repo ID
This commit relaxes the "mirror" schema regex from only allow hashes to the repo ID regex as described in https://dnf.readthedocs.io/en/latest/conf_ref.html#description This is needed because in e.g. bootc-image-builder we use "SetRootDir()" to get the repository information from an existing bootc image and there the repo_id (that is then used as the mirror_id) is written in a human friendly way instead of hex. Thanks to Tomáš Hozza for the suggestions and background info, see https://github.com/osbuild/osbuild/pull/1974#issuecomment-2579325272
This commit is contained in:
parent
b2a34d8b33
commit
65a7ce2461
2 changed files with 11 additions and 5 deletions
|
|
@ -140,9 +140,9 @@ def test_librepo_secrets_mtls(mocked_download_pkgs, sources_service, monkeypatch
|
|||
@pytest.mark.parametrize("test_mirrors,expected_err", [
|
||||
# bad
|
||||
(
|
||||
# only hashes supported for mirror_ids
|
||||
{"bad_mirror_id": {"url": "http://example.com", "type": "mirrorlist"}},
|
||||
"'bad_mirror_id' does not match any of the regexes: '^[0-9a-f]+$'",
|
||||
# no spaces in mirror_id
|
||||
{"bad mirror": {"url": "http://example.com", "type": "mirrorlist"}},
|
||||
"'bad mirror' does not match any of the regexes: ",
|
||||
),
|
||||
(
|
||||
{"0123456789abcdef": {"type": "mirrorlist"}},
|
||||
|
|
@ -168,7 +168,10 @@ def test_librepo_secrets_mtls(mocked_download_pkgs, sources_service, monkeypatch
|
|||
),
|
||||
(
|
||||
{"0123": {"url": "http://example.com", "type": "baseurl"}}, "",
|
||||
)
|
||||
),
|
||||
(
|
||||
{"Com_plex:id.": {"url": "http://x.com", "type": "baseurl"}}, "",
|
||||
),
|
||||
])
|
||||
def test_schema_validation(sources_schema, test_mirrors, expected_err):
|
||||
test_input = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue