bridge: Exit beiboot when ssh exits

The cockpit.beiboot process shouldn't live on when its `ssh` process
exits during the session. Note that we must only do this after the ferny
negotiation, as that sends its own (specific) problem codes.

Covered by `TestSession.testBasic`.
This commit is contained in:
Martin Pitt 2024-09-25 08:02:29 +02:00 committed by Martin Pitt
parent b1eed72239
commit cc7720f94a

View file

@ -400,6 +400,10 @@ class SshBridge(Router):
logger.debug("SshBridge.do_init: %r", message)
self.ssh_peer.write_control(message)
def setup_session(self) -> None:
# if ssh dies during the session, go down with it
self.ssh_peer.add_done_callback(self.close)
async def run(args) -> None:
logger.debug("Hi. How are you today?")
@ -464,6 +468,7 @@ async def run(args) -> None:
return
logger.debug('Startup done. Looping until connection closes.')
bridge.setup_session()
try:
await bridge.communicate()
except BrokenPipeError: