/opt/docker/stacks/<app> is the catalog's template copy and stays after a clean remove, so every remove printed it as a leftover (2026-10-24, 9202).
This commit is contained in:
1 parent
7de554e954
commit
5e196e1ab8
4 files changed
+21
-1
No files matched your search
+3
-1
@@ -595,7 +595,9 @@ def remove(name):
|
||||
say(f" [X] remove (keeping drive data) -> {code} {str(d)[:160]}")
|
||||
time.sleep(5)
|
||||
st = stack(name)
|
||||
left = guest(f"ls -d /opt/docker/stacks/{name} 2>/dev/null; "
|
||||
# The stack folder itself stays: it is the catalog's template copy (every app has one). An install leaves its record,
|
||||
# app.yaml — that is the leftover to look for (2026-10-24: the folder alone read as a leftover after a clean remove).
|
||||
left = guest(f"ls -d /opt/docker/stacks/{name}/app.yaml 2>/dev/null; "
|
||||
f"docker ps -a --filter label=com.docker.compose.project={name} --format '{{{{.Names}}}}'")
|
||||
say(f" [X] after remove: deployed={st.get('deployed')} leftovers={left.strip()!r}")
|
||||
return code
|
||||
|
||||
@@ -454,6 +454,19 @@ class BoxWalkTargets(unittest.TestCase):
|
||||
self.assertEqual(len(made), 1)
|
||||
self.assertNotIn("scratch_hdd ", made[0] + " ") # the drive root itself is never mkdir-ed
|
||||
|
||||
def test_remove_looks_for_the_install_record_not_the_template_folder(self):
|
||||
"""/opt/docker/stacks/<app> is the catalog's template copy and stays after a clean remove; app.yaml is the
|
||||
install's record. RED-PROOF: check the folder again → fails."""
|
||||
bw = self.load({"BASE": "https://192.0.2.1"})
|
||||
seen = []
|
||||
with mock.patch.object(bw, "ctl", return_value=("200", {"ok": True})), \
|
||||
mock.patch.object(bw, "stack", return_value={"deployed": False}), \
|
||||
mock.patch.object(bw, "guest", side_effect=lambda script, timeout=600: seen.append(script) or ""), \
|
||||
mock.patch.object(bw, "say"), mock.patch.object(bw.time, "sleep"):
|
||||
bw.remove("qbittorrent")
|
||||
check = [c for c in seen if "/opt/docker/stacks/" in c]
|
||||
self.assertTrue(check and "/opt/docker/stacks/qbittorrent/app.yaml" in check[-1], seen)
|
||||
|
||||
def test_an_unknown_target_is_refused(self):
|
||||
with self.assertRaises(SystemExit):
|
||||
self.load({"TARGET": "ep0"})
|
||||
|
||||
Reference in new issue
Block a user