mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-05 06:09:57 -05:00
Onboarding a drive keeps a library on the internal disk (#828)
The onboarding wizard deleted /media/wrolpi/config before mounting a drive, and the shadowed data check ignored config/. A library kept on the internal disk keeps wrolpi.db and its configs there, so onboarding a drive later deleted them without warning. Only a config/ holding nothing but the ssl/ CA is now treated as transient. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1554dfb268
commit
b83a9cf017
4 changed files with 89 additions and 25 deletions
|
|
@ -437,13 +437,24 @@ class TestCheckShadowedData:
|
|||
assert check_shadowed_data(str(target)) is None
|
||||
|
||||
def test_returns_none_when_only_config_present(self, tmp_path):
|
||||
"""`config/` is whitelisted — it's expected pre-mount state."""
|
||||
"""A `config/` holding only the CA from generate_certificates.sh is expected pre-mount state."""
|
||||
target = tmp_path / "wrolpi"
|
||||
target.mkdir()
|
||||
(target / "config").mkdir()
|
||||
(target / "config" / "ssl.crt").write_text("cert")
|
||||
(target / "config" / "ssl").mkdir(parents=True)
|
||||
(target / "config" / "ssl" / "ca.crt").write_text("cert")
|
||||
assert check_shadowed_data(str(target)) is None
|
||||
|
||||
def test_detects_config_with_user_data(self, tmp_path):
|
||||
"""A library kept on the internal disk has its database and configs in `config/`."""
|
||||
target = tmp_path / "wrolpi"
|
||||
target.mkdir()
|
||||
(target / "config" / "ssl").mkdir(parents=True)
|
||||
(target / "config" / "ssl" / "ca.crt").write_text("cert")
|
||||
(target / "config" / "wrolpi.db").write_bytes(b"x" * 10)
|
||||
result = check_shadowed_data(str(target))
|
||||
assert result["entries"] == ["config"]
|
||||
assert result["size_bytes"] == 14
|
||||
|
||||
def test_detects_directory_entry(self, tmp_path):
|
||||
target = tmp_path / "wrolpi"
|
||||
target.mkdir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue