feat: add troubleshooting flows and extend ops learning content

This commit is contained in:
likingcode
2026-03-10 09:31:09 +08:00
parent f3d5f92478
commit 89d2c3b4a3
3 changed files with 119 additions and 24 deletions

View File

@@ -548,6 +548,7 @@ class LinuxSandbox:
canned = {
"clear": "[screen cleared]",
"id": "uid=1000(sandbox_user) gid=1000(sandbox_user) groups=1000(sandbox_user),999(docker)",
"uptime": " 10:00:00 up 5 days, 2 users, load average: 0.10, 0.12, 0.08",
"w": " 10:00:00 up 5 days, 2 users, load average: 0.10, 0.12, 0.08\nUSER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT\nsandbox pts/0 localhost 10:00 1:20 0.01s 0.00s bash",
"last": "sandbox_user pts/0 localhost Mon Mar 6 10:04 still logged in\nreboot system boot 5.15.0 Mon Mar 6 10:00",
"passwd": "Changing password for sandbox_user... (simulated)",
@@ -612,6 +613,8 @@ class LinuxSandbox:
return canned["whereis"]
if cmd_name == "dig":
return canned.get("dig", ";; ANSWER SECTION:\nexample.com. 300 IN A 93.184.216.34")
if cmd_name in {"uptime", "lsof", "sort", "uniq", "cut", "awk", "sed"}:
return canned.get(cmd_name, f"{cmd_name}: simulated")
if cmd_name == "export" and args and "=" in args[0]:
key, value = args[0].split("=", 1)
self.env[key] = value