Avoid using deprecated 'id' field in Docker events (#6307)

This commit is contained in:
Stefan Agner 2025-11-12 20:44:01 +01:00 committed by GitHub
parent d541fe5c3a
commit d85aedc42b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -89,7 +89,7 @@ class DockerMonitor(CoreSysAttributes, Thread):
DockerContainerStateEvent(
name=attributes["name"],
state=container_state,
id=event["id"],
id=event["Actor"]["ID"],
time=event["time"],
),
)

View File

@ -88,7 +88,7 @@ async def test_events(
):
"""Test events created from docker events."""
event["Actor"]["Attributes"]["name"] = "some_container"
event["id"] = "abc123"
event["Actor"]["ID"] = "abc123"
event["time"] = 123
with (
patch(
@ -131,12 +131,12 @@ async def test_unlabeled_container(coresys: CoreSys):
new=PropertyMock(
return_value=[
{
"id": "abc123",
"time": 123,
"Type": "container",
"Action": "die",
"Actor": {
"Attributes": {"name": "homeassistant", "exitCode": "137"}
"ID": "abc123",
"Attributes": {"name": "homeassistant", "exitCode": "137"},
},
}
]