Fix clustering event properties
This patch revises the properties of the Event resource of the clustering service to match to the recent changes at server side. The 'obj_id', 'obj_type', 'obj_name' properties are now renamed to 'oid', 'otype', 'oname' respectively to avoid conflicts with oslo versionedobject implementation. Change-Id: I24c7fc4c4afd948910a1b4e2ca7804f38aa12dae
This commit is contained in:
parent
33cd41e31e
commit
b91935c80f
|
@ -12,7 +12,6 @@
|
|||
|
||||
|
||||
from openstack.cluster import cluster_service
|
||||
from openstack import format
|
||||
from openstack import resource
|
||||
|
||||
|
||||
|
@ -27,15 +26,26 @@ class Event(resource.Resource):
|
|||
allow_retrieve = True
|
||||
|
||||
# Properties
|
||||
id = resource.prop('id')
|
||||
timestamp = resource.prop('timestamp', type=format.ISO8601)
|
||||
obj_id = resource.prop('obj_id')
|
||||
obj_name = resource.prop('obj_name')
|
||||
obj_type = resource.prop('obj_type')
|
||||
#: Timestamp string (in ISO8601 format) when the event was generated.
|
||||
generated_at = resource.prop('timestamp')
|
||||
#: The UUID of the object related to this event.
|
||||
obj_id = resource.prop('oid')
|
||||
#: The name of the object related to this event.
|
||||
obj_name = resource.prop('oname')
|
||||
#: The type name of the object related to this event.
|
||||
obj_type = resource.prop('otype')
|
||||
#: The UUID of the cluster related to this event, if any.
|
||||
cluster_id = resource.prop('cluster_id')
|
||||
#: The event level (priority).
|
||||
level = resource.prop('level')
|
||||
#: The ID of the user.
|
||||
user_id = resource.prop('user')
|
||||
#: The ID of the project (tenant).
|
||||
project_id = resource.prop('project')
|
||||
#: The string representation of the action associated with the event.
|
||||
action = resource.prop('action')
|
||||
#: The status of the associated object.
|
||||
status = resource.prop('status')
|
||||
#: A string description of the reason that brought the object into its
|
||||
#: current status.
|
||||
status_reason = resource.prop('status_reason')
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
|
||||
import testtools
|
||||
|
||||
from openstack.cluster.v1 import event
|
||||
|
@ -24,9 +22,9 @@ FAKE = {
|
|||
'id': 'ffaed25e-46f5-4089-8e20-b3b4722fd597',
|
||||
'level': '20',
|
||||
'metadata': {},
|
||||
'obj_id': 'efff1c11-2ada-47da-bedd-2c9af4fd099a',
|
||||
'obj_name': 'node_create_b4a49016',
|
||||
'obj_type': 'NODEACTION',
|
||||
'oid': 'efff1c11-2ada-47da-bedd-2c9af4fd099a',
|
||||
'oname': 'node_create_b4a49016',
|
||||
'otype': 'NODEACTION',
|
||||
'project': '42d9e9663331431f97b75e25136307ff',
|
||||
'status': 'START',
|
||||
'status_reason': 'The action was abandoned.',
|
||||
|
@ -57,13 +55,11 @@ class TestEvent(testtools.TestCase):
|
|||
self.assertEqual(FAKE['deleted_time'], sot.deleted_time)
|
||||
self.assertEqual(FAKE['level'], sot.level)
|
||||
self.assertEqual(FAKE['metadata'], sot.metadata)
|
||||
self.assertEqual(FAKE['obj_id'], sot.obj_id)
|
||||
self.assertEqual(FAKE['obj_name'], sot.obj_name)
|
||||
self.assertEqual(FAKE['obj_type'], sot.obj_type)
|
||||
self.assertEqual(FAKE['oid'], sot.obj_id)
|
||||
self.assertEqual(FAKE['oname'], sot.obj_name)
|
||||
self.assertEqual(FAKE['otype'], sot.obj_type)
|
||||
self.assertEqual(FAKE['project'], sot.project_id)
|
||||
self.assertEqual(FAKE['status'], sot.status)
|
||||
self.assertEqual(FAKE['status_reason'], sot.status_reason)
|
||||
dt = datetime.datetime(2016, 10, 10, 12, 46, 36, 000000).replace(
|
||||
tzinfo=None)
|
||||
self.assertEqual(dt, sot.timestamp.replace(tzinfo=None))
|
||||
self.assertEqual(FAKE['timestamp'], sot.generated_at)
|
||||
self.assertEqual(FAKE['user'], sot.user_id)
|
||||
|
|
Loading…
Reference in New Issue