selinux_fix_screen
selinux_fix_screen
¶
Modal that offers the two SELinux-policy fixes after a setup exit 5.
The sandbox setup CLI handler exits with code 5 when all install
phases succeed but the host's SELinux policy is missing — see
terok-ai/terok-sandbox#298.
The TUI catches that exit code and pushes this screen.
Two paths forward:
- Install the policy (sudo bash …) — dispatches the bundled installer script as a console action; the user authenticates to sudo in the captured-log view. After a successful install, the caller re-runs setup.
- Switch to TCP mode — flips
services.modetotcpin the user-scopeconfig.yml; no SELinux policy is required after the flip. The caller re-runs setup.
A Skip button bails out without changing anything (the operator can re-open the same modal from the command palette by re-running setup).
SelinuxFixOutcome
¶
Bases: Enum
User's pick from SelinuxFixScreen.
INSTALL_POLICY = 'install_policy'
class-attribute
instance-attribute
¶
Run sudo bash <install_script> to load terok_socket_t.
SWITCH_TO_TCP = 'switch_to_tcp'
class-attribute
instance-attribute
¶
Write services.mode: tcp to the user config and re-run setup.
SKIPPED = 'skipped'
class-attribute
instance-attribute
¶
Dismiss without changing anything.
SelinuxFixScreen
¶
Bases: ModalScreen[SelinuxFixOutcome]
Modal that surfaces the two remediations for a setup exit-5 finish.
BINDINGS = [Binding('escape', 'close', 'Close'), Binding('i', 'install_policy', 'Install policy'), Binding('t', 'switch_to_tcp', 'Switch to TCP'), Binding('s', 'skip', 'Skip')]
class-attribute
instance-attribute
¶
CSS = '\n SelinuxFixScreen {\n align: center middle;\n }\n\n #selinux-fix-dialog {\n width: 80;\n max-width: 100%;\n height: auto;\n max-height: 80%;\n border: heavy $primary;\n border-title-align: right;\n background: $surface;\n padding: 1 2;\n }\n\n #selinux-fix-headline {\n height: auto;\n margin-bottom: 1;\n }\n\n #selinux-fix-blurb {\n color: $text-muted;\n height: auto;\n margin-bottom: 1;\n }\n\n #selinux-fix-buttons {\n height: auto;\n align-horizontal: right;\n }\n\n #selinux-fix-buttons Button {\n margin-left: 1;\n }\n '
class-attribute
instance-attribute
¶
compose()
¶
Build the modal: headline, explanation, three buttons.
Source code in src/terok/tui/selinux_fix_screen.py
action_close()
¶
Esc dismisses with SelinuxFixOutcome.SKIPPED.
action_install_policy()
¶
action_switch_to_tcp()
¶
action_skip()
¶
on_button_pressed(event)
¶
Route the three button IDs to their dismissal outcomes.