Skip to content

Commit

Permalink
Merge pull request containers#11529 from n1hility/fix-oldfields
Browse files Browse the repository at this point in the history
Add deprecated event fields for 1.22+ clients that still expect them
  • Loading branch information
openshift-merge-robot authored Sep 13, 2021
2 parents 473f958 + 3c77a98 commit b603c7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/domain/entities/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
8 changes: 8 additions & 0 deletions test/apiv2/python/rest_api/test_v2_0_0_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ def test_events(self):
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 = (
Expand Down

0 comments on commit b603c7a

Please sign in to comment.