Skip to content

Commit d85aedc

Browse files
authored
Avoid using deprecated 'id' field in Docker events (#6307)
1 parent d541fe5 commit d85aedc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

supervisor/docker/monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def run(self) -> None:
8989
DockerContainerStateEvent(
9090
name=attributes["name"],
9191
state=container_state,
92-
id=event["id"],
92+
id=event["Actor"]["ID"],
9393
time=event["time"],
9494
),
9595
)

tests/docker/test_monitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async def test_events(
8888
):
8989
"""Test events created from docker events."""
9090
event["Actor"]["Attributes"]["name"] = "some_container"
91-
event["id"] = "abc123"
91+
event["Actor"]["ID"] = "abc123"
9292
event["time"] = 123
9393
with (
9494
patch(
@@ -131,12 +131,12 @@ async def test_unlabeled_container(coresys: CoreSys):
131131
new=PropertyMock(
132132
return_value=[
133133
{
134-
"id": "abc123",
135134
"time": 123,
136135
"Type": "container",
137136
"Action": "die",
138137
"Actor": {
139-
"Attributes": {"name": "homeassistant", "exitCode": "137"}
138+
"ID": "abc123",
139+
"Attributes": {"name": "homeassistant", "exitCode": "137"},
140140
},
141141
}
142142
]

0 commit comments

Comments
 (0)