Files
esh-pfi-infrastructure/playbooks/svos-releases/nh3-svos-seats-repo-albok.yaml
T

41 lines
2.3 KiB
YAML

# nh3-svos: add repo-albok to [[seats.repos]] so albok-dev's pane is adopted as a seat (Prime 0020 2026-10-19 via svos-dev,
# thread 01M59G7BVAS52Q8ACFV4ZFBD8E). Config only: check-config, then reload (SIGHUP); no restart, no card.
# Placed in true alphabetical order (first, before repo-augaman; order is not load-bearing: adoption is a longest-path match).
steps:
- name: Back up instance.toml, then insert the repo before repo-augaman
sudo: true
shell: |
set -e
p=/var/lib/svos/config/instance.toml
runuser -u svc-svos -- cp -p $p $p.pre-repo-albok
runuser -u svc-svos -- python3 - <<'PY'
import os
p = "/var/lib/svos/config/instance.toml"; s = open(p, encoding="utf-8").read()
assert 'name = "repo-albok"' not in s
anchor = '[[seats.repos]]\nname = "repo-augaman"\n'
assert s.count(anchor) == 1
add = '[[seats.repos]] # 2026-10-19 (Prime): albok-dev on the tree\nname = "repo-albok"\npath = "/home/lkraven/development/albok"\n'
s = s.replace(anchor, add + anchor)
t = p + ".tmp"; fd = os.open(t, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
with os.fdopen(fd, "w", encoding="utf-8") as f: f.write(s)
os.replace(t, p); print("edited")
PY
- name: check-config (restore on refusal), then reload
sudo: true
shell: |
if ! runuser -u svc-svos -- /opt/svos/current/kernel-env/bin/svos-kernel check-config --data-root /var/lib/svos; then
runuser -u svc-svos -- cp -p /var/lib/svos/config/instance.toml.pre-repo-albok /var/lib/svos/config/instance.toml; echo RESTORED; exit 1; fi
systemctl reload svos-kernel; sleep 4; curl -s http://127.0.0.1:8400/health; echo
verify:
- name: Health ok on the new generation; dev-albok adopted
sudo: true
shell: |
sleep 8
curl -s http://127.0.0.1:8400/health; echo
python3 -c "
import sqlite3
c = sqlite3.connect('file:/var/lib/svos/state/svos.db?mode=ro', uri=True)
print(c.execute(\"select name, repo, role, runtime, state, origin from seats where repo='repo-albok'\").fetchall())
for r in c.execute(\"select id, at, kind, action, object, summary from events where object like '%albok%' or action like 'config%' order by id desc limit 6\"): print(r)"
changed_when: "false"