mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 20:06:22 -05:00
Repair: restart a running tunnel and torrents, so an upgrade loads their new code (#1040)
repair.sh ends with systemctl start wrolpi.target, which leaves a running unit as it was. wrolpi-vpn (the root tunnel) and wrolpi-torrent kept the old code until a reboot, so a tunnel.py fix did not apply after an upgrade. try-restart restarts them only if they are running. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
87ed2ffeb8
commit
5806882f85
2 changed files with 12 additions and 0 deletions
|
|
@ -674,6 +674,15 @@ class TestInstalled:
|
|||
'etc/raspberrypios/wrolpi.target'):
|
||||
assert 'wrolpi-vpn.service' in (REPOSITORY / script).read_text(), script
|
||||
|
||||
def test_repair_restarts_a_running_tunnel(self):
|
||||
"""An upgrade (which ends with repair.sh) must load a new tunnel.py: `systemctl start wrolpi.target` leaves a
|
||||
running tunnel on the old code. Torrents are restarted with it (they run in its namespace, behind its kill
|
||||
switch). try-restart: neither is started if it was not running."""
|
||||
repair = (REPOSITORY / 'repair.sh').read_text()
|
||||
restart = 'systemctl try-restart wrolpi-vpn.service wrolpi-torrent.service'
|
||||
assert restart in repair
|
||||
assert repair.index(restart) < repair.index('systemctl start wrolpi.target')
|
||||
|
||||
def test_packages(self):
|
||||
for packages in ('pi-gen/stage2/04-wrolpi/01-packages-nr',
|
||||
'debian-live-config/config/package-lists/wrolpi.list.chroot'):
|
||||
|
|
|
|||
|
|
@ -219,6 +219,9 @@ fi
|
|||
systemctl restart wrolpi-help
|
||||
# Restarted, not only started: its config may have changed.
|
||||
systemctl restart wrolpi-rsyncd || :
|
||||
# A running tunnel (and torrents, in its namespace) must load the new code; starting wrolpi.target leaves it as it
|
||||
# was. Only if running: a stopped VPN stays stopped.
|
||||
systemctl try-restart wrolpi-vpn.service wrolpi-torrent.service || :
|
||||
systemctl start wrolpi.target
|
||||
|
||||
set +x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue