fe998b8847
gates / gates (push) Successful in 2m27s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
20 lines
1.2 KiB
Python
20 lines
1.2 KiB
Python
import sys, time
|
|
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
|
|
import box_walk as w
|
|
name = sys.argv[1]; dirs = sys.argv[2:]
|
|
EVF = open(f"{w.EV}/teardown.txt", "a", buffering=1)
|
|
def say(*a):
|
|
w.say(*a); EVF.write(" ".join(map(str, a)) + "\n")
|
|
w.login()
|
|
c, d = w.ctl("POST", f"/api/stacks/{name}/stop"); say(f"{name}: stop -> {c}")
|
|
for _ in range(24):
|
|
time.sleep(5)
|
|
if w.stack(name).get("state") != "running": break
|
|
c, d = w.ctl("POST", f"/api/stacks/{name}/remove", {"remove_hdd_data": False, "remove_backups": True}); say(f"{name}: remove (keep drive data, drop backups) -> {c} {str(d)[:120]}")
|
|
time.sleep(5)
|
|
for p in dirs:
|
|
assert p.startswith("/mnt/felhom-drives/scratch_hdd/") and p.count("/") >= 5 and p.rstrip("/").split("/")[-1] == name, p
|
|
say(f"{name}: tidy own folders by name:", w.guest("for p in " + " ".join(dirs) + "; do [ -d $p ] && rm -rf $p && echo removed $p; done; true").strip())
|
|
st = w.stack(name)
|
|
say(f"{name}: after: deployed={st.get('deployed')} leftovers={w.guest(f'ls -d /opt/docker/stacks/{name} 2>/dev/null; docker ps -a --filter label=com.docker.compose.project={name} --format {{{{.Names}}}}; docker volume ls -q --filter label=com.docker.compose.project={name}').strip()!r}")
|