тест 10
This commit is contained in:
@@ -354,11 +354,21 @@ class VmixAgentHub:
|
||||
return key.split(".", 1)[0] if key else ""
|
||||
|
||||
@staticmethod
|
||||
def _agent_supports_batch(version: Any) -> bool:
|
||||
def _agent_version_tuple(version: Any) -> tuple[int, int, int] | None:
|
||||
match = re.search(r"(\d+)\.(\d+)\.(\d+)", str(version or ""))
|
||||
if not match:
|
||||
return False
|
||||
return tuple(int(part) for part in match.groups()) >= (1, 4, 0)
|
||||
return None
|
||||
return tuple(int(part) for part in match.groups())
|
||||
|
||||
@classmethod
|
||||
def _agent_supports_mapping_inventory(cls, version: Any) -> bool:
|
||||
parsed = cls._agent_version_tuple(version)
|
||||
return bool(parsed is not None and parsed >= (1, 3, 0))
|
||||
|
||||
@classmethod
|
||||
def _agent_supports_batch(cls, version: Any) -> bool:
|
||||
parsed = cls._agent_version_tuple(version)
|
||||
return bool(parsed is not None and parsed >= (1, 4, 0))
|
||||
|
||||
|
||||
@staticmethod
|
||||
@@ -1068,6 +1078,14 @@ class VmixAgentHub:
|
||||
if not assignment_id or not match_id:
|
||||
return {"ok": False, "reason": "no_match_assignment", "device_id": device_id}
|
||||
if not fingerprint:
|
||||
if agent_version and not self._agent_supports_mapping_inventory(agent_version):
|
||||
return {
|
||||
"ok": False,
|
||||
"reason": "agent_mapping_unsupported",
|
||||
"device_id": device_id,
|
||||
"agent_version": agent_version,
|
||||
"required_agent_version": "1.3.0",
|
||||
}
|
||||
return {"ok": False, "reason": "no_project_inventory", "device_id": device_id}
|
||||
if not vmix_connected:
|
||||
return {"ok": False, "reason": "vmix_not_connected", "device_id": device_id}
|
||||
@@ -2354,6 +2372,8 @@ class VmixAgentHub:
|
||||
"device_id": row.device_uuid,
|
||||
"name": row.name or row.hostname or row.device_uuid,
|
||||
"hostname": row.hostname,
|
||||
"agent_version": row.agent_version or "",
|
||||
"mapping_supported": self._agent_supports_mapping_inventory(row.agent_version),
|
||||
"online": row.device_uuid in self._live,
|
||||
"vmix_connected": bool(row.vmix_connected),
|
||||
"vmix_version": row.vmix_version,
|
||||
|
||||
Reference in New Issue
Block a user