Skip to content

Commit b603c7a

Browse files
Merge pull request #11529 from n1hility/fix-oldfields
Add deprecated event fields for 1.22+ clients that still expect them
2 parents 473f958 + 3c77a98 commit b603c7a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/domain/entities/events.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ func ConvertToEntitiesEvent(e libpodEvents.Event) *Event {
6060
attributes["name"] = e.Name
6161
attributes["containerExitCode"] = strconv.Itoa(e.ContainerExitCode)
6262
return &Event{dockerEvents.Message{
63+
// Compatibility with clients that still look for deprecated API elements
64+
Status: e.Status.String(),
65+
ID: e.ID,
66+
From: e.Image,
6367
Type: e.Type.String(),
6468
Action: e.Status.String(),
6569
Actor: dockerEvents.Actor{

test/apiv2/python/rest_api/test_v2_0_0_system.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ def test_events(self):
2929
obj = json.loads(line)
3030
# Actor.ID is uppercase for compatibility
3131
self.assertIn("ID", obj["Actor"])
32+
# Verify 1.22+ deprecated variants are present if current originals are
33+
if (obj["Actor"]["ID"]):
34+
self.assertEqual(obj["Actor"]["ID"], obj["id"])
35+
if (obj["Action"]):
36+
self.assertEqual(obj["Action"], obj["status"])
37+
if (obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image")):
38+
self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"])
39+
3240

3341
def test_ping(self):
3442
required_headers = (

0 commit comments

Comments
 (0)