fix(ssh): 修复 More 分页标记清除导致同行设备数据丢失

_clean_output 中 `---- More ----[^\n]*` 会将整行删除,当 OLT
输出的 More 分页标记与设备数据出现在同一行时,该设备会被错误丢弃。
改为仅移除标记文本本身,保留同行后续的设备数据。

Olt 172.16.0.18 的 display onu slot 1 输出 93 台设备,修复前仅
解析出 90 台(丢失 3 台),修复后正确解析全部 93 台。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-21 18:10:47 +08:00
parent bd341df9de
commit b5d542a725
+2 -2
View File
@@ -176,8 +176,8 @@ class SSHService:
"""清理终端控制字符和 More 分页标记,避免污染解析"""
# 移除 ANSI 转义序列
output = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', output)
# 移除 ---- More ---- 行(含前后控制字符
output = re.sub(r'---- More ----[^\n]*', '', output)
# 移除 ---- More ---- 标记(仅标记本身,保留同行后续设备数据
output = re.sub(r'---- More ----', '', output)
# 将独立的 \r(不跟 \n)替换为空,避免覆盖行内容
output = re.sub(r'\r(?!\n)', '', output)
return output