From 3c77a98e4582dd1ddd1820506068b03575109dfe Mon Sep 17 00:00:00 2001 From: "Jason T. Greene" Date: Fri, 10 Sep 2021 00:50:41 -0500 Subject: Add deprecated fields for 1.22+ clients that still expect them Signed-off-by: Jason Greene --- pkg/domain/entities/events.go | 4 ++++ test/apiv2/python/rest_api/test_v2_0_0_system.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/domain/entities/events.go b/pkg/domain/entities/events.go index 5e7cc9ad1..73a375b94 100644 --- a/pkg/domain/entities/events.go +++ b/pkg/domain/entities/events.go @@ -60,6 +60,10 @@ func ConvertToEntitiesEvent(e libpodEvents.Event) *Event { attributes["name"] = e.Name attributes["containerExitCode"] = strconv.Itoa(e.ContainerExitCode) return &Event{dockerEvents.Message{ + // Compatibility with clients that still look for deprecated API elements + Status: e.Status.String(), + ID: e.ID, + From: e.Image, Type: e.Type.String(), Action: e.Status.String(), Actor: dockerEvents.Actor{ diff --git a/test/apiv2/python/rest_api/test_v2_0_0_system.py b/test/apiv2/python/rest_api/test_v2_0_0_system.py index 3dfd08525..3e94f187d 100644 --- a/test/apiv2/python/rest_api/test_v2_0_0_system.py +++ b/test/apiv2/python/rest_api/test_v2_0_0_system.py @@ -28,6 +28,14 @@ class SystemTestCase(APITestCase): obj = json.loads(line) # Actor.ID is uppercase for compatibility self.assertIn("ID", obj["Actor"]) + # Verify 1.22+ deprecated variants are present if current originals are + if (obj["Actor"]["ID"]): + self.assertEqual(obj["Actor"]["ID"], obj["id"]) + if (obj["Action"]): + self.assertEqual(obj["Action"], obj["status"]) + if (obj["Actor"].get("Attributes") and obj["Actor"]["Attributes"].get("image")): + self.assertEqual(obj["Actor"]["Attributes"]["image"], obj["from"]) + def test_ping(self): required_headers = ( -- cgit v1.2.3-54-g00ecf