From b698c51d7bd3aa0708eca571568a9f02c5699242 Mon Sep 17 00:00:00 2001 From: Bo Tran Date: Mon, 26 Aug 2019 21:53:24 +0700 Subject: [PATCH] Add a fields meta_data to result of Senlin API Current, when I call API to list all events with description in here: https://docs.openstack.org/api-ref/clustering/?expanded=list-events-detail#list-events and in result maybe return event objects with meta_data field and this help useful for my works. But when i get events use python-senlinclient, i can't do that. So i want add to meta_data field to response when i use python-senlinclient. Thanks. Change-Id: I85d52027f6f20e9ec9a0ffa50dadaeed649b7d7f --- openstack/clustering/v1/event.py | 2 ++ openstack/tests/unit/clustering/v1/test_event.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openstack/clustering/v1/event.py b/openstack/clustering/v1/event.py index cd556257c..d88b1c0d6 100644 --- a/openstack/clustering/v1/event.py +++ b/openstack/clustering/v1/event.py @@ -52,3 +52,5 @@ class Event(resource.Resource): #: A string description of the reason that brought the object into its #: current status. status_reason = resource.Body('status_reason') + #: The metadata of an event object. + meta_data = resource.Body('meta_data') diff --git a/openstack/tests/unit/clustering/v1/test_event.py b/openstack/tests/unit/clustering/v1/test_event.py index e52a44218..9a972580f 100644 --- a/openstack/tests/unit/clustering/v1/test_event.py +++ b/openstack/tests/unit/clustering/v1/test_event.py @@ -27,7 +27,13 @@ FAKE = { 'status': 'START', 'status_reason': 'The action was abandoned.', 'timestamp': '2016-10-10T12:46:36.000000', - 'user': '5e5bf8027826429c96af157f68dc9072' + 'user': '5e5bf8027826429c96af157f68dc9072', + 'meta_data': { + "action": { + "created_at": "2019-07-13T13:18:18Z", + "outputs": {} + } + } } @@ -58,3 +64,4 @@ class TestEvent(base.TestCase): self.assertEqual(FAKE['status_reason'], sot.status_reason) self.assertEqual(FAKE['timestamp'], sot.generated_at) self.assertEqual(FAKE['user'], sot.user_id) + self.assertEqual(FAKE['meta_data'], sot.meta_data)