Fix T6 occupancy parsing in host agent

This commit is contained in:
2026-10-04 20:20:10 -04:00
parent ed004ddbcf
commit 456af32b36
5 changed files with 80 additions and 8 deletions
+13 -3
View File
@@ -30,7 +30,7 @@ import urllib.parse
import urllib.request
import uuid
VERSION = "1.4.0"
VERSION = "1.4.1"
LABEL = "io.electric-cherry"
MAX_FILE = 32 * 1024 * 1024
LIBRARY_DOWNLOAD_WORKERS = 4
@@ -169,7 +169,8 @@ def file_digest(path):
def status_players(text):
lines = text.splitlines()
separator = next((index for index, line in enumerate(lines) if re.match(r"^\s*-+\s+-+", line)), None)
if separator is not None and any(re.search(r"\bnum\s+score\s+ping\b", line, re.I) for line in lines[:separator]):
# T6 includes a bot column; T5 places ping directly after score.
if separator is not None and any(re.search(r"\bnum\s+score\s+(?:bot\s+)?ping\b", line, re.I) for line in lines[:separator]):
rows = [line.strip() for line in lines[separator + 1:] if line.strip()]
if any(not re.match(r"^\d+\s+", row) for row in rows):
return None
@@ -1013,7 +1014,16 @@ class Agent:
raise Held("Container state is unknown; disruption held")
result = self.rcon(instance_id, generation, "status")
if not result.get("ok") or result.get("players") is None:
raise Held("Fresh local player occupancy is unavailable; disruption held")
# Keep diagnostics bounded and do not include raw replies: they may
# contain player addresses or echoed credentials.
reason = {
"unconfigured": "local RCON password is not configured",
"unreachable": "local RCON endpoint is unreachable",
"invalid-reply": "local RCON reply has an invalid packet prefix",
"timeout": "local RCON status query timed out",
"authentication": "local RCON authentication failed",
}.get(result.get("reason"), "local RCON status reply has no recognized player count" if result.get("ok") else "local RCON query failed")
raise Held(f"Fresh local player occupancy is unavailable: {reason}; disruption held")
if result["players"] != 0:
raise Held("Players are present; disruption held")
+2 -2
View File
@@ -1,8 +1,8 @@
{
"version": "1.4.0",
"version": "1.4.1",
"protocolVersion": 1,
"platform": "debian-amd64",
"sha256": "8bb6bf3c433def0540cf0de11304f23820c9afcaf1d90d8cdaa7a2a09a455f2d",
"sha256": "0691d8457f52ef8b53691b627733352b2f187529a4ecc465cdaaa6e27ddaaaa7",
"updaterProtocolVersion": 1,
"updaterSha256": "066bb896726600ece9ce72697ce523c9a707cc9a621505931ba0892dec59d3c8"
}