mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 00:00:21 +02:00
Devices: while an install runs, nothing elsewhere moves it to another headset (review round 29)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
747dbcf72f
commit
b87be6866b
2 files changed
+21
-5
No files matched your search
@@ -139,6 +139,22 @@ class Connecting(unittest.TestCase):
|
||||
self.link.work = lambda: 0
|
||||
self.assertEqual(self.link.active_device()["alias"], "frame-2") # idle: move on
|
||||
|
||||
def test_nothing_elsewhere_moves_a_running_install(self):
|
||||
"""A bare alias in use, then another server sets up and picks a headset."""
|
||||
self.link.override = None
|
||||
self.hosts({"localhost": "ok"})
|
||||
with mock.patch.object(fl, "ssh_g", return_value=("localhost", self.port, "tester", False)):
|
||||
self.link.connect(["start"])
|
||||
started = self.routes[-1]
|
||||
other = fd.Registry(self.dir / "devices.json")
|
||||
other.set_active(other.add_device("frame-2", hosts=["192.0.2.2"])["id"])
|
||||
self.link.work = lambda: 1
|
||||
with mock.patch.object(fl, "ssh_g", return_value=("localhost", self.port, "tester", False)):
|
||||
self.link.close_master()
|
||||
self.link.connect(["dropped"])
|
||||
self.assertEqual(self.routes[-1][0], started[0])
|
||||
self.assertTrue(self.link.deferred)
|
||||
|
||||
def listen6(self):
|
||||
"""A "different device": the same port on IPv6 loopback."""
|
||||
try:
|
||||
|
||||
+5
-5
@@ -487,11 +487,11 @@ class Link:
|
||||
device = dict(device, user=device.get("user") or u, port=p, frozen_host=h, proxied=proxied, frozen=[
|
||||
"-o", f"HostName={frame_devices.ssh_host(h)}", "-o", f"Port={p}",
|
||||
*(["-o", f"User={u}"] if u else [])])
|
||||
if self.routed and self.routed_device and device["alias"] == self.routed_device["alias"] \
|
||||
and self.route_key(device) != self.routed and self.work():
|
||||
# Set Up Connection changed this headset in ~/.ssh/config (its login, or a bare
|
||||
# alias became a set-up headset) while an install runs: reconnect as it
|
||||
# started; the change applies once it's done (see watch_config).
|
||||
if self.routed and self.routed_device and self.route_key(device) != self.routed and self.work():
|
||||
# While an install runs, nothing moves it: not Set Up Connection changing this
|
||||
# headset in ~/.ssh/config, nor another Frame Control server adding, choosing
|
||||
# or removing headsets in devices.json. (Switching here is refused meanwhile.)
|
||||
# Reconnect as it started; the change applies once it's done (see watch_config).
|
||||
device = self.routed_device
|
||||
self.deferred = True
|
||||
if self.route_key(device) != self.routed:
|
||||
|
||||
Reference in new issue
Block a user