mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: enhance repository configuration to support url_to_replace patterns for disabling existing entries
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
+136
-3
@@ -48,7 +48,9 @@ def test_is_relevant_true_with_apk_dir(tmp_path) -> None:
|
||||
assert ApkModule().is_relevant(context) is True
|
||||
|
||||
|
||||
def test_apply_disables_existing_and_adds_configured_repositories(tmp_path) -> None:
|
||||
def test_apply_copies_existing_repositories_unchanged_without_url_to_replace(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
apk_dir = src / "etc/apk"
|
||||
apk_dir.mkdir(parents=True)
|
||||
@@ -62,11 +64,13 @@ def test_apply_disables_existing_and_adds_configured_repositories(tmp_path) -> N
|
||||
|
||||
ApkModule().apply(context)
|
||||
|
||||
# No configured repository declares a url_to_replace, so the existing
|
||||
# lines are copied through unchanged, still active.
|
||||
content = (dst / "etc/apk/repositories").read_text(encoding="utf-8")
|
||||
assert content == (
|
||||
"# comment\n"
|
||||
"# https://old-mirror.invalid/v3.18/main\n"
|
||||
"# https://old-mirror.invalid/v3.18/community\n"
|
||||
"https://old-mirror.invalid/v3.18/main\n"
|
||||
"https://old-mirror.invalid/v3.18/community\n"
|
||||
"https://example.invalid/v3.19/main\n"
|
||||
"https://example.invalid/v3.19/community\n"
|
||||
)
|
||||
@@ -75,6 +79,42 @@ def test_apply_disables_existing_and_adds_configured_repositories(tmp_path) -> N
|
||||
assert key_content == KEY_BYTES
|
||||
|
||||
|
||||
def test_apply_disables_only_existing_lines_matching_url_to_replace(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
apk_dir = src / "etc/apk"
|
||||
apk_dir.mkdir(parents=True)
|
||||
(apk_dir / "repositories").write_text(
|
||||
"https://old-mirror.invalid/v3.18/main\nhttps://old-mirror.invalid/v3.18/community\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"apk": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "main",
|
||||
"url": "https://example.invalid/v3.19/main",
|
||||
"url_to_replace": "https://old-mirror.invalid/v3.18/main",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=Configuration.model_validate(data), dst=dst, src=src)
|
||||
|
||||
ApkModule().apply(context)
|
||||
|
||||
content = (dst / "etc/apk/repositories").read_text(encoding="utf-8")
|
||||
assert content == (
|
||||
"# https://old-mirror.invalid/v3.18/main\n"
|
||||
"https://old-mirror.invalid/v3.18/community\n"
|
||||
"https://example.invalid/v3.19/main\n"
|
||||
)
|
||||
|
||||
|
||||
def test_apply_without_existing_repositories_file(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
(src / "etc/apk").mkdir(parents=True)
|
||||
@@ -90,6 +130,99 @@ def test_apply_without_existing_repositories_file(tmp_path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_apply_skips_repository_when_url_to_replace_matches_nothing(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
apk_dir = src / "etc/apk"
|
||||
apk_dir.mkdir(parents=True)
|
||||
(apk_dir / "repositories").write_text(
|
||||
"https://old-mirror.invalid/v3.18/main\n", encoding="utf-8"
|
||||
)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"apk": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "main",
|
||||
"url": "https://example.invalid/v3.19/main",
|
||||
"url_to_replace": "https://other.invalid/*",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=Configuration.model_validate(data), dst=dst, src=src)
|
||||
|
||||
ApkModule().apply(context)
|
||||
|
||||
content = (dst / "etc/apk/repositories").read_text(encoding="utf-8")
|
||||
assert "example.invalid" not in content
|
||||
|
||||
|
||||
def test_apply_writes_repository_when_url_to_replace_matches_existing(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
apk_dir = src / "etc/apk"
|
||||
apk_dir.mkdir(parents=True)
|
||||
(apk_dir / "repositories").write_text(
|
||||
"https://old-mirror.invalid/v3.18/main\n", encoding="utf-8"
|
||||
)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"apk": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "main",
|
||||
"url": "https://example.invalid/v3.19/main",
|
||||
"url_to_replace": "https://old-mirror.invalid/*",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=Configuration.model_validate(data), dst=dst, src=src)
|
||||
|
||||
ApkModule().apply(context)
|
||||
|
||||
content = (dst / "etc/apk/repositories").read_text(encoding="utf-8")
|
||||
assert "https://example.invalid/v3.19/main" in content
|
||||
|
||||
|
||||
def test_apply_reuses_cached_existing_urls_and_handles_missing_file(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
(src / "etc/apk").mkdir(parents=True)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"apk": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "main",
|
||||
"url": "https://example.invalid/v3.19/main",
|
||||
"url_to_replace": "https://old.invalid/*",
|
||||
},
|
||||
{
|
||||
"name": "community",
|
||||
"url": "https://example.invalid/v3.19/community",
|
||||
"url_to_replace": "https://old.invalid/*",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=Configuration.model_validate(data), dst=dst, src=src)
|
||||
|
||||
ApkModule().apply(context)
|
||||
|
||||
assert not (dst / "etc/apk/repositories").exists()
|
||||
|
||||
|
||||
def test_apply_writes_nothing_when_no_repositories_at_all(tmp_path) -> None:
|
||||
empty_config = Configuration.model_validate(
|
||||
{"uuid": "12345678-1234-5678-1234-567812345678", "organisation": "InterDiode"}
|
||||
|
||||
+163
-12
@@ -70,7 +70,9 @@ def test_is_relevant_true_with_apt_dir(tmp_path) -> None:
|
||||
assert AptModule().is_relevant(context) is True
|
||||
|
||||
|
||||
def test_apply_disables_existing_sources_and_adds_configured_ones(tmp_path) -> None:
|
||||
def test_apply_copies_existing_sources_unchanged_without_uri_to_replace(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
apt_dir = src / "etc/apt"
|
||||
sources_list_d = apt_dir / "sources.list.d"
|
||||
@@ -97,24 +99,24 @@ def test_apply_disables_existing_sources_and_adds_configured_ones(tmp_path) -> N
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
disabled_top_level = (dst / "etc/apt/sources.list").read_text(encoding="utf-8")
|
||||
# No configured source declares a uri_to_replace, so none of the existing
|
||||
# entries are disabled: they are copied through unchanged.
|
||||
top_level = (dst / "etc/apt/sources.list").read_text(encoding="utf-8")
|
||||
assert (
|
||||
disabled_top_level
|
||||
== "# already disabled\n# deb http://example.invalid/legacy stable main\n\n"
|
||||
top_level
|
||||
== "# already disabled\ndeb http://example.invalid/legacy stable main\n\n"
|
||||
)
|
||||
|
||||
disabled_list = (dst / "etc/apt/sources.list.d/extra.list").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert disabled_list == "# deb http://example.invalid/extra stable main\n"
|
||||
extra_list = (dst / "etc/apt/sources.list.d/extra.list").read_text(encoding="utf-8")
|
||||
assert extra_list == "deb http://example.invalid/extra stable main\n"
|
||||
|
||||
disabled_sources = (dst / "etc/apt/sources.list.d/docker.sources").read_text(
|
||||
docker_sources = (dst / "etc/apt/sources.list.d/docker.sources").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert disabled_sources == (
|
||||
"Types: deb\nURIs: http://example.invalid/docker\nSuites: stable\nEnabled: no"
|
||||
assert docker_sources == (
|
||||
"Types: deb\nURIs: http://example.invalid/docker\nSuites: stable\nEnabled: yes"
|
||||
"\n\n"
|
||||
"Types: deb\nURIs: http://example.invalid/docker2\nSuites: stable\nEnabled: no\n"
|
||||
"Types: deb\nURIs: http://example.invalid/docker2\nSuites: stable\n"
|
||||
)
|
||||
|
||||
assert not (dst / "etc/apt/sources.list.d/ignored.txt").exists()
|
||||
@@ -133,6 +135,55 @@ def test_apply_disables_existing_sources_and_adds_configured_ones(tmp_path) -> N
|
||||
)
|
||||
|
||||
|
||||
def test_apply_disables_only_existing_sources_matching_uri_to_replace(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
apt_dir = src / "etc/apt"
|
||||
sources_list_d = apt_dir / "sources.list.d"
|
||||
sources_list_d.mkdir(parents=True)
|
||||
|
||||
(apt_dir / "sources.list").write_text(
|
||||
"deb http://example.invalid/legacy stable main\n", encoding="utf-8"
|
||||
)
|
||||
(sources_list_d / "extra.list").write_text(
|
||||
"deb http://example.invalid/extra stable main\n", encoding="utf-8"
|
||||
)
|
||||
(sources_list_d / "docker.sources").write_text(
|
||||
"Types: deb\nURIs: http://example.invalid/extra\nSuites: stable\nEnabled: yes\n"
|
||||
"\n"
|
||||
"Types: deb\nURIs: http://example.invalid/docker2\nSuites: stable\n"
|
||||
"\n\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
config=make_config_with({"uri-to-replace": "http://example.invalid/extra"}),
|
||||
dst=dst,
|
||||
src=src,
|
||||
)
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
# The legacy source doesn't match the pattern, so it stays enabled...
|
||||
top_level = (dst / "etc/apt/sources.list").read_text(encoding="utf-8")
|
||||
assert top_level == "deb http://example.invalid/legacy stable main\n"
|
||||
|
||||
# ...but every entry whose URI matches is disabled, regardless of format.
|
||||
extra_list = (dst / "etc/apt/sources.list.d/extra.list").read_text(encoding="utf-8")
|
||||
assert extra_list == "# deb http://example.invalid/extra stable main\n"
|
||||
|
||||
docker_sources = (dst / "etc/apt/sources.list.d/docker.sources").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
assert docker_sources == (
|
||||
"Types: deb\nURIs: http://example.invalid/extra\nSuites: stable\nEnabled: no"
|
||||
"\n\n"
|
||||
"Types: deb\nURIs: http://example.invalid/docker2\nSuites: stable\n"
|
||||
)
|
||||
|
||||
|
||||
def test_apply_without_existing_top_level_sources_list(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
(src / "etc/apt").mkdir(parents=True)
|
||||
@@ -200,6 +251,106 @@ def test_apply_without_signed_by_writes_no_field(tmp_path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_apply_skips_source_when_uri_to_replace_matches_nothing(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
apt_dir = src / "etc/apt"
|
||||
apt_dir.mkdir(parents=True)
|
||||
(apt_dir / "sources.list").write_text(
|
||||
"deb http://example.invalid/legacy stable main\n", encoding="utf-8"
|
||||
)
|
||||
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
config=make_config_with({"uri-to-replace": "http://other.invalid/*"}),
|
||||
dst=dst,
|
||||
src=src,
|
||||
)
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
assert not (dst / "etc/apt/sources.list.d/interdiode.sources").exists()
|
||||
|
||||
|
||||
def test_apply_writes_source_when_uri_to_replace_matches_existing_uri(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
apt_dir = src / "etc/apt"
|
||||
apt_dir.mkdir(parents=True)
|
||||
(apt_dir / "sources.list").write_text(
|
||||
"deb http://legacy.invalid/debian stable main\n", encoding="utf-8"
|
||||
)
|
||||
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
config=make_config_with({"uri-to-replace": "http://legacy.invalid/*"}),
|
||||
dst=dst,
|
||||
src=src,
|
||||
)
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
assert (dst / "etc/apt/sources.list.d/interdiode.sources").exists()
|
||||
|
||||
|
||||
def test_apply_skips_source_when_uri_to_replace_set_without_src(tmp_path) -> None:
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
config=make_config_with({"uri-to-replace": "http://*"}), dst=dst, src=None
|
||||
)
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
assert not (dst / "etc/apt/sources.list.d/interdiode.sources").exists()
|
||||
|
||||
|
||||
def test_apply_matches_uri_to_replace_across_list_line_variants(tmp_path) -> None:
|
||||
src = tmp_path / "src"
|
||||
apt_dir = src / "etc/apt"
|
||||
sources_list_d = apt_dir / "sources.list.d"
|
||||
sources_list_d.mkdir(parents=True)
|
||||
|
||||
(apt_dir / "sources.list").write_text(
|
||||
"# a comment\n"
|
||||
"\n"
|
||||
"garbage line here\n"
|
||||
"deb [unterminated bracket with no closing marker\n"
|
||||
"deb [arch=amd64 trusted=yes] http://example.invalid/extra stable main\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(sources_list_d / "ignored.txt").write_text("not a source file\n", encoding="utf-8")
|
||||
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"apt": {
|
||||
"sources": [
|
||||
{
|
||||
"name": "first",
|
||||
"uris": ["http://example.invalid/first"],
|
||||
"suites": ["stable"],
|
||||
"uri-to-replace": "http://example.invalid/extra",
|
||||
},
|
||||
{
|
||||
"name": "second",
|
||||
"uris": ["http://example.invalid/second"],
|
||||
"suites": ["stable"],
|
||||
"uri-to-replace": "http://example.invalid/extra",
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=Configuration.model_validate(data), dst=dst, src=src)
|
||||
|
||||
AptModule().apply(context)
|
||||
|
||||
assert (dst / "etc/apt/sources.list.d/first.sources").exists()
|
||||
assert (dst / "etc/apt/sources.list.d/second.sources").exists()
|
||||
|
||||
|
||||
def test_apply_sanitizes_source_name_with_slash(tmp_path) -> None:
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(
|
||||
|
||||
+155
-7
@@ -126,7 +126,9 @@ def test_apply_unsigned_repo_disables_gpgcheck(tmp_path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_apply_disables_existing_repos_before_adding_configured_ones(tmp_path) -> None:
|
||||
def test_apply_copies_existing_repos_unchanged_without_index_url_to_replace(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
repos_dir = src / "etc/yum.repos.d"
|
||||
repos_dir.mkdir(parents=True)
|
||||
@@ -148,13 +150,13 @@ def test_apply_disables_existing_repos_before_adding_configured_ones(tmp_path) -
|
||||
|
||||
YumModule().apply(context)
|
||||
|
||||
disabled_multi = (dst / "etc/yum.repos.d/multi.repo").read_text(encoding="utf-8")
|
||||
assert "[old-one]" in disabled_multi
|
||||
assert "[old-two]" in disabled_multi
|
||||
# No configured repository declares an index_url_to_replace, so the
|
||||
# existing sections are copied through unchanged, still enabled.
|
||||
copied_multi = (dst / "etc/yum.repos.d/multi.repo").read_text(encoding="utf-8")
|
||||
parser = ConfigParser(interpolation=None)
|
||||
parser.read_string(disabled_multi)
|
||||
assert parser["old-one"]["enabled"] == "0"
|
||||
assert parser["old-two"]["enabled"] == "0"
|
||||
parser.read_string(copied_multi)
|
||||
assert parser["old-one"]["enabled"] == "1"
|
||||
assert parser["old-two"]["enabled"] == "1"
|
||||
|
||||
assert not (dst / "etc/yum.repos.d/ignored.txt").exists()
|
||||
|
||||
@@ -165,6 +167,152 @@ def test_apply_disables_existing_repos_before_adding_configured_ones(tmp_path) -
|
||||
)
|
||||
|
||||
|
||||
def test_apply_disables_only_existing_sections_matching_index_url_to_replace(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
repos_dir = src / "etc/yum.repos.d"
|
||||
repos_dir.mkdir(parents=True)
|
||||
(repos_dir / "multi.repo").write_text(
|
||||
"[old-one]\nname=old-one\nbaseurl=https://old-one.invalid\nenabled=1\ngpgcheck=1\n"
|
||||
"\n"
|
||||
"[old-two]\nname=old-two\nbaseurl=https://old-two.invalid\nenabled=1\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"yum": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "unsigned",
|
||||
"index-url": "https://example.invalid/yum",
|
||||
"index-url-to-replace": "https://old-one.invalid",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(data), dst=dst, src=src)
|
||||
|
||||
YumModule().apply(context)
|
||||
|
||||
disabled_multi = (dst / "etc/yum.repos.d/multi.repo").read_text(encoding="utf-8")
|
||||
parser = ConfigParser(interpolation=None)
|
||||
parser.read_string(disabled_multi)
|
||||
assert parser["old-one"]["enabled"] == "0"
|
||||
assert parser["old-two"]["enabled"] == "1"
|
||||
|
||||
|
||||
def test_apply_skips_repository_when_index_url_to_replace_matches_nothing(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
repos_dir = src / "etc/yum.repos.d"
|
||||
repos_dir.mkdir(parents=True)
|
||||
(repos_dir / "old.repo").write_text(
|
||||
"[old]\nname=old\nbaseurl=https://old.invalid\nenabled=1\n", encoding="utf-8"
|
||||
)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"yum": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "unsigned",
|
||||
"index-url": "https://example.invalid/yum",
|
||||
"index-url-to-replace": "https://other.invalid/*",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(data), dst=dst, src=src)
|
||||
|
||||
YumModule().apply(context)
|
||||
|
||||
assert not (dst / "etc/yum.repos.d/unsigned.repo").exists()
|
||||
|
||||
|
||||
def test_apply_writes_repository_when_index_url_to_replace_matches_existing(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
repos_dir = src / "etc/yum.repos.d"
|
||||
repos_dir.mkdir(parents=True)
|
||||
(repos_dir / "old.repo").write_text(
|
||||
"[old]\nname=old\nbaseurl=https://old.invalid/yum\nenabled=1\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"yum": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "unsigned",
|
||||
"index-url": "https://example.invalid/yum",
|
||||
"index-url-to-replace": "https://old.invalid/*",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(data), dst=dst, src=src)
|
||||
|
||||
YumModule().apply(context)
|
||||
|
||||
assert (dst / "etc/yum.repos.d/unsigned.repo").exists()
|
||||
|
||||
|
||||
def test_apply_matches_index_url_to_replace_with_unrelated_files_and_multiple_repos(
|
||||
tmp_path,
|
||||
) -> None:
|
||||
src = tmp_path / "src"
|
||||
repos_dir = src / "etc/yum.repos.d"
|
||||
repos_dir.mkdir(parents=True)
|
||||
(repos_dir / "old.repo").write_text(
|
||||
"[old]\nname=old\nbaseurl=https://old.invalid/yum\nenabled=1\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(repos_dir / "ignored.txt").write_text("not a repo file\n", encoding="utf-8")
|
||||
|
||||
data = {
|
||||
"uuid": "12345678-1234-5678-1234-567812345678",
|
||||
"organisation": "InterDiode",
|
||||
"configurations": {
|
||||
"yum": {
|
||||
"repositories": [
|
||||
{
|
||||
"name": "first",
|
||||
"index-url": "https://example.invalid/first",
|
||||
"index-url-to-replace": "https://old.invalid/*",
|
||||
},
|
||||
{
|
||||
"name": "second",
|
||||
"index-url": "https://example.invalid/second",
|
||||
"index-url-to-replace": "https://old.invalid/*",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
dst = tmp_path / "dst"
|
||||
context = Context(config=make_config(data), dst=dst, src=src)
|
||||
|
||||
YumModule().apply(context)
|
||||
|
||||
assert (dst / "etc/yum.repos.d/first.repo").exists()
|
||||
assert (dst / "etc/yum.repos.d/second.repo").exists()
|
||||
|
||||
|
||||
def test_apply_sanitizes_repository_and_key_names_with_slash(
|
||||
tmp_path, monkeypatch
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user