Add status_message to objects and notifications
This patch is part of the skipped action blueprint. It adds the `status_message` field to the Audit, ActionPlan and Action objects and all related notifications. It bumps the versions of all the affected objects and notifications and update the tests to include the new fields. Change-Id: I3b9467e7e37188e647379cd9c4cbbda8ed75383f Signed-off-by: Alfredo Moralejo <amoralej@redhat.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "CANCELLED",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -24,6 +25,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "CANCELLING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "FAILED",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -34,6 +35,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "CANCELLING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "CANCELLING",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -24,6 +25,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "CANCELLING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -23,6 +24,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "DELETED",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -23,6 +24,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "SUCCEEDED",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -24,6 +25,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "FAILED",
|
||||
"status_message": "Action execution failed",
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -34,6 +35,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -24,6 +25,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
"watcher_object.name": "ActionStateUpdatePayload",
|
||||
"watcher_object.data": {
|
||||
"old_state": "PENDING",
|
||||
"state": "ONGOING"
|
||||
"state": "ONGOING",
|
||||
"status_message": null
|
||||
}
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"action_plan": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
@@ -32,6 +34,7 @@
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"deleted_at": null
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"scope": [],
|
||||
"audit_type": "ONESHOT",
|
||||
"state": "SUCCEEDED",
|
||||
"status_message": null,
|
||||
"parameters": {},
|
||||
"interval": null,
|
||||
"updated_at": null
|
||||
@@ -29,6 +30,7 @@
|
||||
"uuid": "76be87bd-3422-43f9-93a0-e85a577e3061",
|
||||
"fault": null,
|
||||
"state": "CANCELLED",
|
||||
"status_message": null,
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"strategy": {
|
||||
|
||||
@@ -52,13 +52,15 @@
|
||||
"scope": [],
|
||||
"updated_at": null,
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": null,
|
||||
"interval": null,
|
||||
"deleted_at": null,
|
||||
"state": "SUCCEEDED"
|
||||
}
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "CANCELLING"
|
||||
"state": "CANCELLING",
|
||||
"status_message": null
|
||||
}
|
||||
},
|
||||
"timestamp": "2016-10-18 09:52:05.219414"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"scope": [],
|
||||
"audit_type": "ONESHOT",
|
||||
"state": "SUCCEEDED",
|
||||
"status_message": null,
|
||||
"parameters": {},
|
||||
"interval": null,
|
||||
"updated_at": null
|
||||
@@ -29,6 +30,7 @@
|
||||
"uuid": "76be87bd-3422-43f9-93a0-e85a577e3061",
|
||||
"fault": null,
|
||||
"state": "CANCELLING",
|
||||
"status_message": null,
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"strategy": {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"interval": null,
|
||||
"deleted_at": null,
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"updated_at": null
|
||||
},
|
||||
@@ -43,6 +44,7 @@
|
||||
"global_efficacy": {},
|
||||
"deleted_at": null,
|
||||
"state": "RECOMMENDED",
|
||||
"status_message": null,
|
||||
"updated_at": null
|
||||
},
|
||||
"watcher_object.namespace": "watcher",
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"parameters": {}
|
||||
},
|
||||
@@ -43,7 +44,8 @@
|
||||
"watcher_object.name": "StrategyPayload",
|
||||
"watcher_object.namespace": "watcher"
|
||||
},
|
||||
"state": "DELETED"
|
||||
"state": "DELETED",
|
||||
"status_message": null
|
||||
},
|
||||
"watcher_object.version": "1.0",
|
||||
"watcher_object.name": "ActionPlanDeletePayload",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"scope": [],
|
||||
"audit_type": "ONESHOT",
|
||||
"state": "SUCCEEDED",
|
||||
"status_message": null,
|
||||
"parameters": {},
|
||||
"interval": null,
|
||||
"updated_at": null
|
||||
@@ -30,6 +31,7 @@
|
||||
"uuid": "76be87bd-3422-43f9-93a0-e85a577e3061",
|
||||
"fault": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"strategy": {
|
||||
|
||||
@@ -55,11 +55,13 @@
|
||||
"audit_type": "ONESHOT",
|
||||
"interval": null,
|
||||
"deleted_at": null,
|
||||
"state": "PENDING"
|
||||
"state": "PENDING",
|
||||
"status_message": null
|
||||
}
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "ONGOING"
|
||||
"state": "ONGOING",
|
||||
"status_message": null
|
||||
}
|
||||
},
|
||||
"timestamp": "2016-10-18 09:52:05.219414"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"scope": [],
|
||||
"audit_type": "ONESHOT",
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"parameters": {},
|
||||
"interval": null,
|
||||
"updated_at": null
|
||||
@@ -30,6 +31,7 @@
|
||||
"uuid": "76be87bd-3422-43f9-93a0-e85a577e3061",
|
||||
"fault": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"strategy": {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"interval": null,
|
||||
"updated_at": null,
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"deleted_at": null,
|
||||
"parameters": {}
|
||||
},
|
||||
@@ -35,6 +36,7 @@
|
||||
"watcher_object.name": "ActionPlanStateUpdatePayload"
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"deleted_at": null,
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
"strategy": {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "PENDING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"goal_uuid": "bc830f84-8ae3-4fc6-8bc6-e3dd15e8b49a",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "DELETED",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"goal_uuid": "bc830f84-8ae3-4fc6-8bc6-e3dd15e8b49a",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": null,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": null,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": null,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"para1": 3.2
|
||||
},
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"updated_at": null,
|
||||
"deleted_at": null,
|
||||
"fault": null,
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"interval": null,
|
||||
"updated_at": null,
|
||||
"state": "ONGOING",
|
||||
"status_message": null,
|
||||
"audit_type": "ONESHOT"
|
||||
},
|
||||
"watcher_object.namespace": "watcher",
|
||||
|
||||
@@ -43,10 +43,13 @@ class ActionPayload(notificationbase.NotificationPayloadBase):
|
||||
'created_at': ('action', 'created_at'),
|
||||
'updated_at': ('action', 'updated_at'),
|
||||
'deleted_at': ('action', 'deleted_at'),
|
||||
|
||||
'status_message': ('action', 'status_message'),
|
||||
}
|
||||
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'uuid': wfields.UUIDField(),
|
||||
@@ -56,6 +59,7 @@ class ActionPayload(notificationbase.NotificationPayloadBase):
|
||||
'parents': wfields.ListOfUUIDsField(nullable=False, default=[]),
|
||||
'action_plan_uuid': wfields.UUIDField(),
|
||||
'action_plan': wfields.ObjectField('TerseActionPlanPayload'),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
|
||||
'created_at': wfields.DateTimeField(nullable=True),
|
||||
'updated_at': wfields.DateTimeField(nullable=True),
|
||||
@@ -70,18 +74,21 @@ class ActionPayload(notificationbase.NotificationPayloadBase):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionStateUpdatePayload(notificationbase.NotificationPayloadBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'old_state': wfields.StringField(nullable=True),
|
||||
'state': wfields.StringField(nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionCreatePayload(ActionPayload):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, action, action_plan):
|
||||
@@ -93,7 +100,8 @@ class ActionCreatePayload(ActionPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionUpdatePayload(ActionPayload):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
fields = {
|
||||
'state_update': wfields.ObjectField('ActionStateUpdatePayload'),
|
||||
}
|
||||
@@ -108,7 +116,8 @@ class ActionUpdatePayload(ActionPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionExecutionPayload(ActionPayload):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
fields = {
|
||||
'fault': wfields.ObjectField('ExceptionPayload', nullable=True),
|
||||
}
|
||||
@@ -123,7 +132,8 @@ class ActionExecutionPayload(ActionPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionCancelPayload(ActionPayload):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
fields = {
|
||||
'fault': wfields.ObjectField('ExceptionPayload', nullable=True),
|
||||
}
|
||||
@@ -138,7 +148,8 @@ class ActionCancelPayload(ActionPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionDeletePayload(ActionPayload):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, action, action_plan):
|
||||
@@ -257,7 +268,11 @@ def send_update(context, action, service='infra-optim',
|
||||
|
||||
state_update = ActionStateUpdatePayload(
|
||||
old_state=old_state,
|
||||
state=action.state if old_state else None)
|
||||
state=action.state if old_state else None,
|
||||
status_message=(
|
||||
action.status_message if old_state and
|
||||
action.status_message else None)
|
||||
)
|
||||
|
||||
versioned_payload = ActionUpdatePayload(
|
||||
action=action,
|
||||
|
||||
@@ -38,6 +38,7 @@ class TerseActionPlanPayload(notificationbase.NotificationPayloadBase):
|
||||
|
||||
'state': ('action_plan', 'state'),
|
||||
'global_efficacy': ('action_plan', 'global_efficacy'),
|
||||
'status_message': ('action_plan', 'status_message'),
|
||||
|
||||
'created_at': ('action_plan', 'created_at'),
|
||||
'updated_at': ('action_plan', 'updated_at'),
|
||||
@@ -46,7 +47,8 @@ class TerseActionPlanPayload(notificationbase.NotificationPayloadBase):
|
||||
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed 'global_efficacy' type Dictionary to List
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
|
||||
fields = {
|
||||
'uuid': wfields.UUIDField(),
|
||||
@@ -54,6 +56,7 @@ class TerseActionPlanPayload(notificationbase.NotificationPayloadBase):
|
||||
'global_efficacy': wfields.FlexibleListOfDictField(nullable=True),
|
||||
'audit_uuid': wfields.UUIDField(),
|
||||
'strategy_uuid': wfields.UUIDField(nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
|
||||
'created_at': wfields.DateTimeField(nullable=True),
|
||||
'updated_at': wfields.DateTimeField(nullable=True),
|
||||
@@ -74,6 +77,7 @@ class ActionPlanPayload(TerseActionPlanPayload):
|
||||
|
||||
'state': ('action_plan', 'state'),
|
||||
'global_efficacy': ('action_plan', 'global_efficacy'),
|
||||
'status_message': ('action_plan', 'status_message'),
|
||||
|
||||
'created_at': ('action_plan', 'created_at'),
|
||||
'updated_at': ('action_plan', 'updated_at'),
|
||||
@@ -82,7 +86,8 @@ class ActionPlanPayload(TerseActionPlanPayload):
|
||||
|
||||
# Version 1.0: Initial version
|
||||
# Vesrsion 1.1: changed global_efficacy type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2 : Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
|
||||
fields = {
|
||||
'audit': wfields.ObjectField('TerseAuditPayload'),
|
||||
@@ -103,11 +108,13 @@ class ActionPlanPayload(TerseActionPlanPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class ActionPlanStateUpdatePayload(notificationbase.NotificationPayloadBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' field
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'old_state': wfields.StringField(nullable=True),
|
||||
'state': wfields.StringField(nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +122,8 @@ class ActionPlanStateUpdatePayload(notificationbase.NotificationPayloadBase):
|
||||
class ActionPlanCreatePayload(ActionPlanPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed global_efficacy_type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, action_plan, audit, strategy):
|
||||
@@ -129,7 +137,8 @@ class ActionPlanCreatePayload(ActionPlanPayload):
|
||||
class ActionPlanUpdatePayload(ActionPlanPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed global_efficacy_type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
fields = {
|
||||
'state_update': wfields.ObjectField('ActionPlanStateUpdatePayload'),
|
||||
}
|
||||
@@ -146,7 +155,8 @@ class ActionPlanUpdatePayload(ActionPlanPayload):
|
||||
class ActionPlanActionPayload(ActionPlanPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed global_efficacy_type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
fields = {
|
||||
'fault': wfields.ObjectField('ExceptionPayload', nullable=True),
|
||||
}
|
||||
@@ -163,7 +173,8 @@ class ActionPlanActionPayload(ActionPlanPayload):
|
||||
class ActionPlanDeletePayload(ActionPlanPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed global_efficacy_type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, action_plan, audit, strategy):
|
||||
@@ -177,7 +188,8 @@ class ActionPlanDeletePayload(ActionPlanPayload):
|
||||
class ActionPlanCancelPayload(ActionPlanPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Changed global_efficacy_type
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' field
|
||||
VERSION = '1.2'
|
||||
fields = {
|
||||
'fault': wfields.ObjectField('ExceptionPayload', nullable=True),
|
||||
}
|
||||
@@ -300,7 +312,11 @@ def send_update(context, action_plan, service='infra-optim',
|
||||
|
||||
state_update = ActionPlanStateUpdatePayload(
|
||||
old_state=old_state,
|
||||
state=action_plan.state if old_state else None)
|
||||
state=action_plan.state if old_state else None,
|
||||
status_message=(
|
||||
action_plan.status_message if old_state and
|
||||
action_plan.status_message else None)
|
||||
)
|
||||
|
||||
versioned_payload = ActionPlanUpdatePayload(
|
||||
action_plan=action_plan,
|
||||
|
||||
@@ -45,6 +45,8 @@ class TerseAuditPayload(notificationbase.NotificationPayloadBase):
|
||||
'created_at': ('audit', 'created_at'),
|
||||
'updated_at': ('audit', 'updated_at'),
|
||||
'deleted_at': ('audit', 'deleted_at'),
|
||||
|
||||
'status_message': ('audit', 'status_message'),
|
||||
}
|
||||
|
||||
# Version 1.0: Initial version
|
||||
@@ -52,7 +54,8 @@ class TerseAuditPayload(notificationbase.NotificationPayloadBase):
|
||||
# Added 'next_run_time' DateTime field,
|
||||
# 'interval' type has been changed from Integer to String
|
||||
# Version 1.2: Added 'name' string field
|
||||
VERSION = '1.2'
|
||||
# Version 1.3: Added 'status_message' string field
|
||||
VERSION = '1.3'
|
||||
|
||||
fields = {
|
||||
'uuid': wfields.UUIDField(),
|
||||
@@ -70,6 +73,8 @@ class TerseAuditPayload(notificationbase.NotificationPayloadBase):
|
||||
'created_at': wfields.DateTimeField(nullable=True),
|
||||
'updated_at': wfields.DateTimeField(nullable=True),
|
||||
'deleted_at': wfields.DateTimeField(nullable=True),
|
||||
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
def __init__(self, audit, goal_uuid, strategy_uuid=None, **kwargs):
|
||||
@@ -94,13 +99,16 @@ class AuditPayload(TerseAuditPayload):
|
||||
'created_at': ('audit', 'created_at'),
|
||||
'updated_at': ('audit', 'updated_at'),
|
||||
'deleted_at': ('audit', 'deleted_at'),
|
||||
|
||||
'status_message': ('audit', 'status_message'),
|
||||
}
|
||||
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'auto_trigger' field,
|
||||
# Added 'next_run_time' field
|
||||
# Version 1.2: Added 'name' string field
|
||||
VERSION = '1.2'
|
||||
# Version 1.3: Added 'status_message' string field
|
||||
VERSION = '1.3'
|
||||
|
||||
fields = {
|
||||
'goal': wfields.ObjectField('GoalPayload'),
|
||||
@@ -122,11 +130,13 @@ class AuditPayload(TerseAuditPayload):
|
||||
@base.WatcherObjectRegistry.register_notification
|
||||
class AuditStateUpdatePayload(notificationbase.NotificationPayloadBase):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Added 'status_message' string field
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'old_state': wfields.StringField(nullable=True),
|
||||
'state': wfields.StringField(nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +145,8 @@ class AuditCreatePayload(AuditPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'auto_trigger' field,
|
||||
# Added 'next_run_time' field
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' string field
|
||||
VERSION = '1.2'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, audit, goal, strategy):
|
||||
@@ -151,7 +162,8 @@ class AuditUpdatePayload(AuditPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'auto_trigger' field,
|
||||
# Added 'next_run_time' field
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' string field
|
||||
VERSION = '1.2'
|
||||
fields = {
|
||||
'state_update': wfields.ObjectField('AuditStateUpdatePayload'),
|
||||
}
|
||||
@@ -170,7 +182,8 @@ class AuditActionPayload(AuditPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'auto_trigger' field,
|
||||
# Added 'next_run_time' field
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' string field
|
||||
VERSION = '1.2'
|
||||
fields = {
|
||||
'fault': wfields.ObjectField('ExceptionPayload', nullable=True),
|
||||
}
|
||||
@@ -189,7 +202,8 @@ class AuditDeletePayload(AuditPayload):
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'auto_trigger' field,
|
||||
# Added 'next_run_time' field
|
||||
VERSION = '1.1'
|
||||
# Version 1.2: Added 'status_message' string field
|
||||
VERSION = '1.2'
|
||||
fields = {}
|
||||
|
||||
def __init__(self, audit, goal, strategy):
|
||||
@@ -296,7 +310,10 @@ def send_update(context, audit, service='infra-optim',
|
||||
|
||||
state_update = AuditStateUpdatePayload(
|
||||
old_state=old_state,
|
||||
state=audit.state if old_state else None)
|
||||
state=audit.state if old_state else None,
|
||||
status_message=(
|
||||
audit.status_message if old_state and
|
||||
audit.status_message else None))
|
||||
|
||||
versioned_payload = AuditUpdatePayload(
|
||||
audit=audit,
|
||||
|
||||
@@ -40,7 +40,8 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
|
||||
# Version 1.0: Initial version
|
||||
# Version 1.1: Added 'action_plan' object field
|
||||
# Version 2.0: Removed 'next' object field, Added 'parents' object field
|
||||
VERSION = '2.0'
|
||||
# Version 2.1: Added 'status_message' object field
|
||||
VERSION = '2.1'
|
||||
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
@@ -52,6 +53,7 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
|
||||
'input_parameters': wfields.DictField(nullable=True),
|
||||
'state': wfields.StringField(nullable=True),
|
||||
'parents': wfields.ListOfStringsField(nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
|
||||
'action_plan': wfields.ObjectField('ActionPlan', nullable=True),
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ class ActionPlan(base.WatcherPersistentObject, base.WatcherObject,
|
||||
# Version 2.0: Removed 'first_action_id' object field
|
||||
# Version 2.1: Changed global_efficacy type
|
||||
# Version 2.2: Added 'hostname' field
|
||||
VERSION = '2.2'
|
||||
# Version 2.3: Added 'status_message' field
|
||||
VERSION = '2.3'
|
||||
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
@@ -124,6 +125,7 @@ class ActionPlan(base.WatcherPersistentObject, base.WatcherObject,
|
||||
|
||||
'audit': wfields.ObjectField('Audit', nullable=True),
|
||||
'strategy': wfields.ObjectField('Strategy', nullable=True),
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
object_fields = {
|
||||
|
||||
@@ -91,7 +91,8 @@ class Audit(base.WatcherPersistentObject, base.WatcherObject,
|
||||
# Version 1.5: Added 'hostname' field
|
||||
# Version 1.6: Added 'start_time' and 'end_time' DateTime fields
|
||||
# Version 1.7: Added 'force' boolean field
|
||||
VERSION = '1.7'
|
||||
# Version 1.8: Added 'status_message' string field
|
||||
VERSION = '1.8'
|
||||
|
||||
dbapi = db_api.get_instance()
|
||||
|
||||
@@ -116,6 +117,8 @@ class Audit(base.WatcherPersistentObject, base.WatcherObject,
|
||||
|
||||
'goal': wfields.ObjectField('Goal', nullable=True),
|
||||
'strategy': wfields.ObjectField('Strategy', nullable=True),
|
||||
|
||||
'status_message': wfields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
object_fields = {
|
||||
|
||||
@@ -59,7 +59,7 @@ def post_get_test_audit_with_predefined_strategy(**kw):
|
||||
audit = api_utils.audit_post_data(**kw)
|
||||
audit_template = db_utils.get_test_audit_template(
|
||||
strategy_id=strategy['id'])
|
||||
del_keys = ['goal_id', 'strategy_id']
|
||||
del_keys = ['goal_id', 'strategy_id', 'status_message']
|
||||
add_keys = {'audit_template_uuid': audit_template['uuid'],
|
||||
}
|
||||
for k in del_keys:
|
||||
@@ -500,7 +500,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
state=objects.audit.State.PENDING,
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
@@ -541,7 +542,7 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
state=objects.audit.State.PENDING,
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname'])
|
||||
'next_run_time', 'hostname', 'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict, expect_errors=True)
|
||||
self.assertEqual(HTTPStatus.BAD_REQUEST, response.status_int)
|
||||
@@ -555,7 +556,7 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname',
|
||||
'audit_template_uuid'])
|
||||
'audit_template_uuid', 'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
@@ -571,7 +572,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname',
|
||||
'audit_template_uuid', 'strategy'])
|
||||
'audit_template_uuid', 'strategy',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
@@ -587,7 +589,7 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname',
|
||||
'audit_template_uuid'],
|
||||
'audit_template_uuid', 'status_message'],
|
||||
use_named_goal=True)
|
||||
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
@@ -604,7 +606,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
# Make the audit template UUID some garbage value
|
||||
audit_dict['audit_template_uuid'] = (
|
||||
'01234567-8910-1112-1314-151617181920')
|
||||
@@ -624,7 +627,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
state=objects.audit.State.PENDING,
|
||||
params_to_exclude=['uuid', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
state = audit_dict['state']
|
||||
del audit_dict['state']
|
||||
with mock.patch.object(self.dbapi, 'create_audit',
|
||||
@@ -641,7 +645,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
@@ -656,7 +661,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
audit_dict['interval'] = '1200'
|
||||
|
||||
@@ -675,7 +681,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
audit_dict['interval'] = '* * * * *'
|
||||
|
||||
@@ -694,7 +701,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
audit_dict['interval'] = 'zxc'
|
||||
|
||||
@@ -714,7 +722,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
|
||||
response = self.post_json('/audits', audit_dict, expect_errors=True)
|
||||
@@ -731,7 +740,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.ONESHOT.value
|
||||
|
||||
response = self.post_json('/audits', audit_dict, expect_errors=True)
|
||||
@@ -747,7 +757,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
state=objects.audit.State.PENDING,
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
response = self.post_json('/audits', audit_dict)
|
||||
de_mock.assert_called_once_with(mock.ANY, response.json['uuid'])
|
||||
|
||||
@@ -769,7 +780,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
parameters={'name': 'Tom'},
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json('/audits', audit_dict, expect_errors=True)
|
||||
self.assertEqual('application/json', response.content_type)
|
||||
@@ -815,7 +827,7 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict['audit_template_uuid'] = audit_template['uuid']
|
||||
del_keys = ['uuid', 'goal_id', 'strategy_id', 'state', 'interval',
|
||||
'scope', 'next_run_time', 'hostname']
|
||||
'scope', 'next_run_time', 'hostname', 'status_message']
|
||||
for k in del_keys:
|
||||
del audit_dict[k]
|
||||
|
||||
@@ -838,7 +850,7 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict['audit_template_uuid'] = audit_template['uuid']
|
||||
del_keys = ['uuid', 'goal_id', 'strategy_id', 'state', 'interval',
|
||||
'scope', 'next_run_time', 'hostname']
|
||||
'scope', 'next_run_time', 'hostname', 'status_message']
|
||||
for k in del_keys:
|
||||
del audit_dict[k]
|
||||
|
||||
@@ -894,7 +906,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
normal_name = 'this audit name is just for test'
|
||||
# long_name length exceeds 63 characters
|
||||
long_name = normal_name + audit_dict['uuid']
|
||||
@@ -921,7 +934,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal']
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message']
|
||||
)
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
audit_dict['interval'] = '1200'
|
||||
@@ -957,7 +971,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal']
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message']
|
||||
)
|
||||
audit_dict['audit_type'] = objects.audit.AuditType.CONTINUOUS.value
|
||||
audit_dict['interval'] = '1200'
|
||||
@@ -982,7 +997,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json(
|
||||
'/audits',
|
||||
@@ -998,7 +1014,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
|
||||
audit_dict['force'] = True
|
||||
response = self.post_json(
|
||||
@@ -1016,7 +1033,8 @@ class TestPost(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
params_to_exclude=['uuid', 'state', 'interval', 'scope',
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'audit_template_uuid', 'name'])
|
||||
'audit_template_uuid', 'name',
|
||||
'status_message'])
|
||||
|
||||
response = self.post_json(
|
||||
'/audits',
|
||||
@@ -1141,7 +1159,8 @@ class TestAuditPolicyEnforcement(api_base.FunctionalTest):
|
||||
audit_dict = post_get_test_audit(
|
||||
state=objects.audit.State.PENDING,
|
||||
params_to_exclude=['uuid', 'state', 'scope',
|
||||
'next_run_time', 'hostname', 'goal'])
|
||||
'next_run_time', 'hostname', 'goal',
|
||||
'status_message'])
|
||||
self._common_policy_check(
|
||||
"audit:create", self.post_json, '/audits', audit_dict,
|
||||
expect_errors=True)
|
||||
|
||||
@@ -99,8 +99,8 @@ def get_test_audit(**kwargs):
|
||||
'hostname': kwargs.get('hostname', 'host_1'),
|
||||
'start_time': kwargs.get('start_time'),
|
||||
'end_time': kwargs.get('end_time'),
|
||||
'force': kwargs.get('force', False)
|
||||
|
||||
'force': kwargs.get('force', False),
|
||||
'status_message': kwargs.get('status_message', None),
|
||||
}
|
||||
# ObjectField doesn't allow None nor dict, so if we want to simulate a
|
||||
# non-eager object loading, the field should not be referenced at all.
|
||||
@@ -141,6 +141,7 @@ def get_test_action(**kwargs):
|
||||
'created_at': kwargs.get('created_at'),
|
||||
'updated_at': kwargs.get('updated_at'),
|
||||
'deleted_at': kwargs.get('deleted_at'),
|
||||
'status_message': kwargs.get('status_message', None),
|
||||
}
|
||||
|
||||
# ObjectField doesn't allow None nor dict, so if we want to simulate a
|
||||
@@ -177,6 +178,7 @@ def get_test_action_plan(**kwargs):
|
||||
'updated_at': kwargs.get('updated_at'),
|
||||
'deleted_at': kwargs.get('deleted_at'),
|
||||
'hostname': kwargs.get('hostname', 'host_1'),
|
||||
'status_message': kwargs.get('status_message', None),
|
||||
}
|
||||
|
||||
# ObjectField doesn't allow None nor dict, so if we want to simulate a
|
||||
|
||||
@@ -191,7 +191,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -247,7 +247,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -310,7 +310,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -406,7 +406,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -505,7 +505,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -609,7 +609,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -730,7 +730,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
@@ -885,7 +885,7 @@ class TestActionScheduling(base.DbTestCase):
|
||||
for src, dst in edges:
|
||||
for key in ('id', 'action_plan', 'action_plan_id', 'created_at',
|
||||
'input_parameters', 'deleted_at', 'updated_at',
|
||||
'state'):
|
||||
'state', 'status_message'):
|
||||
del src[key]
|
||||
del dst[key]
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@ class TestActionNotification(base.DbTestCase):
|
||||
action = utils.create_test_action(
|
||||
mock.Mock(), state=objects.action.State.ONGOING,
|
||||
action_type='nop', input_parameters={'param1': 1, 'param2': 2},
|
||||
parents=[], action_plan_id=self.action_plan.id)
|
||||
parents=[], action_plan_id=self.action_plan.id,
|
||||
status_message="Test status message")
|
||||
notifications.action.send_update(
|
||||
mock.MagicMock(), action, host='node0',
|
||||
old_state=objects.action.State.PENDING)
|
||||
@@ -74,7 +75,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionUpdatePayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -86,17 +87,18 @@ class TestActionNotification(base.DbTestCase):
|
||||
'updated_at': None,
|
||||
'state_update': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionStateUpdatePayload',
|
||||
'watcher_object.data': {
|
||||
'old_state': 'PENDING',
|
||||
'state': 'ONGOING'
|
||||
'state': 'ONGOING',
|
||||
'status_message': 'Test status message'
|
||||
}
|
||||
},
|
||||
'state': 'ONGOING',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -108,12 +110,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': 'Test status message'
|
||||
}
|
||||
},
|
||||
payload
|
||||
@@ -135,7 +139,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionCreatePayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -148,7 +152,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'PENDING',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -160,12 +164,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
payload
|
||||
@@ -189,7 +195,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionDeletePayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -202,7 +208,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'DELETED',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -214,12 +220,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
payload
|
||||
@@ -244,7 +252,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'event_type': 'action.execution.start',
|
||||
'payload': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionExecutionPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -258,7 +266,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'PENDING',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -270,12 +278,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -283,11 +293,13 @@ class TestActionNotification(base.DbTestCase):
|
||||
)
|
||||
|
||||
def test_send_action_execution_with_error(self):
|
||||
self.action_plan.status_message = 'Action plan status message'
|
||||
self.action_plan.save()
|
||||
action = utils.create_test_action(
|
||||
mock.Mock(), state=objects.action.State.FAILED,
|
||||
action_type='nop', input_parameters={'param1': 1, 'param2': 2},
|
||||
parents=[], action_plan_id=self.action_plan.id)
|
||||
|
||||
parents=[], action_plan_id=self.action_plan.id,
|
||||
status_message='Action status message')
|
||||
try:
|
||||
# This is to load the exception in sys.exc_info()
|
||||
raise exception.WatcherException("TEST")
|
||||
@@ -304,7 +316,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'event_type': 'action.execution.error',
|
||||
'payload': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionExecutionPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -331,24 +343,26 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'FAILED',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
'global_efficacy': [],
|
||||
'created_at': '2016-10-18T09:52:05Z',
|
||||
'updated_at': None,
|
||||
'updated_at': '2016-10-18T09:52:05Z',
|
||||
'state': 'ONGOING',
|
||||
'audit_uuid': '10a47dd1-4874-4298'
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': 'Action plan status message'
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': 'Action status message'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -374,7 +388,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'event_type': 'action.cancel.start',
|
||||
'payload': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionCancelPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -388,7 +402,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'PENDING',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -400,12 +414,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -434,7 +450,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'event_type': 'action.cancel.error',
|
||||
'payload': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.0',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.name': 'ActionCancelPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '10a47dd1-4874-4298-91cf-eff046dbdb8d',
|
||||
@@ -461,7 +477,7 @@ class TestActionNotification(base.DbTestCase):
|
||||
'state': 'FAILED',
|
||||
'action_plan': {
|
||||
'watcher_object.namespace': 'watcher',
|
||||
'watcher_object.version': '1.1',
|
||||
'watcher_object.version': '1.2',
|
||||
'watcher_object.name': 'TerseActionPlanPayload',
|
||||
'watcher_object.data': {
|
||||
'uuid': '76be87bd-3422-43f9-93a0-e85a577e3061',
|
||||
@@ -473,12 +489,14 @@ class TestActionNotification(base.DbTestCase):
|
||||
'-91cf-eff046dbdb8d',
|
||||
'strategy_uuid': 'cb3d0b58-4415-4d90'
|
||||
'-b75b-1e96878730e3',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
},
|
||||
'parents': [],
|
||||
'action_type': 'nop',
|
||||
'deleted_at': None
|
||||
'deleted_at': None,
|
||||
'status_message': None
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -57,7 +57,8 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
action_plan = utils.create_test_action_plan(
|
||||
mock.Mock(), state=objects.action_plan.State.ONGOING,
|
||||
audit_id=self.audit.id, strategy_id=self.strategy.id,
|
||||
audit=self.audit, strategy=self.strategy)
|
||||
audit=self.audit, strategy=self.strategy,
|
||||
status_message="Test status message")
|
||||
notifications.action_plan.send_update(
|
||||
mock.MagicMock(), action_plan, host='node0',
|
||||
old_state=objects.action_plan.State.PENDING)
|
||||
@@ -72,7 +73,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
@@ -108,22 +109,25 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.2"
|
||||
"watcher_object.version": "1.3"
|
||||
},
|
||||
"deleted_at": None,
|
||||
"state": "ONGOING",
|
||||
"status_message": 'Test status message',
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"state_update": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.data": {
|
||||
"old_state": "PENDING",
|
||||
"state": "ONGOING"
|
||||
"state": "ONGOING",
|
||||
"status_message": "Test status message",
|
||||
},
|
||||
"watcher_object.name": "ActionPlanStateUpdatePayload"
|
||||
},
|
||||
@@ -149,7 +153,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
@@ -185,14 +189,16 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.2"
|
||||
"watcher_object.version": "1.3"
|
||||
},
|
||||
"deleted_at": None,
|
||||
"state": "PENDING",
|
||||
"status_message": None,
|
||||
"updated_at": None,
|
||||
"created_at": None,
|
||||
},
|
||||
@@ -218,7 +224,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"global_efficacy": [],
|
||||
"strategy_uuid": "cb3d0b58-4415-4d90-b75b-1e96878730e3",
|
||||
@@ -254,14 +260,16 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.2"
|
||||
"watcher_object.version": "1.3"
|
||||
},
|
||||
"deleted_at": None,
|
||||
"state": "DELETED",
|
||||
"status_message": None,
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
},
|
||||
@@ -297,7 +305,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"audit": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.version": "1.3",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -313,11 +321,13 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
}
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "ONGOING",
|
||||
"status_message": None,
|
||||
"strategy_uuid": (
|
||||
"cb3d0b58-4415-4d90-b75b-1e96878730e3"),
|
||||
"strategy": {
|
||||
@@ -339,7 +349,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
},
|
||||
"watcher_object.name": "ActionPlanActionPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
@@ -399,14 +409,16 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.2"
|
||||
"watcher_object.version": "1.3"
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "ONGOING",
|
||||
"status_message": None,
|
||||
"strategy_uuid": (
|
||||
"cb3d0b58-4415-4d90-b75b-1e96878730e3"),
|
||||
"strategy": {
|
||||
@@ -428,7 +440,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
},
|
||||
"watcher_object.name": "ActionPlanActionPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
@@ -460,7 +472,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"audit": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.version": "1.3",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -476,11 +488,13 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
}
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "ONGOING",
|
||||
"status_message": None,
|
||||
"strategy_uuid": (
|
||||
"cb3d0b58-4415-4d90-b75b-1e96878730e3"),
|
||||
"strategy": {
|
||||
@@ -502,7 +516,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
},
|
||||
"watcher_object.name": "ActionPlanCancelPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
@@ -562,14 +576,16 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "TerseAuditPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.2"
|
||||
"watcher_object.version": "1.3"
|
||||
},
|
||||
"global_efficacy": [],
|
||||
"state": "ONGOING",
|
||||
"status_message": None,
|
||||
"strategy_uuid": (
|
||||
"cb3d0b58-4415-4d90-b75b-1e96878730e3"),
|
||||
"strategy": {
|
||||
@@ -591,7 +607,7 @@ class TestActionPlanNotification(base.DbTestCase):
|
||||
},
|
||||
"watcher_object.name": "ActionPlanCancelPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
|
||||
@@ -70,7 +70,7 @@ class TestAuditNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -115,14 +115,16 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"state_update": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.data": {
|
||||
"old_state": "PENDING",
|
||||
"state": "ONGOING"
|
||||
"state": "ONGOING",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditStateUpdatePayload"
|
||||
},
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditUpdatePayload"
|
||||
},
|
||||
@@ -132,7 +134,8 @@ class TestAuditNotification(base.DbTestCase):
|
||||
def test_send_audit_update_without_strategy(self):
|
||||
audit = utils.get_test_audit(
|
||||
mock.Mock(), interval=None, state=objects.audit.State.ONGOING,
|
||||
goal_id=self.goal.id, goal=self.goal)
|
||||
goal_id=self.goal.id, goal=self.goal,
|
||||
status_message='Fake message')
|
||||
notifications.audit.send_update(
|
||||
mock.MagicMock(), audit, host='node0',
|
||||
old_state=objects.audit.State.PENDING)
|
||||
@@ -145,7 +148,7 @@ class TestAuditNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -177,14 +180,16 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"created_at": None,
|
||||
"state_update": {
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.0",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.data": {
|
||||
"old_state": "PENDING",
|
||||
"state": "ONGOING"
|
||||
"state": "ONGOING",
|
||||
"status_message": "Fake message"
|
||||
},
|
||||
"watcher_object.name": "AuditStateUpdatePayload"
|
||||
},
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": "Fake message"
|
||||
},
|
||||
"watcher_object.name": "AuditUpdatePayload"
|
||||
},
|
||||
@@ -207,7 +212,7 @@ class TestAuditNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -250,7 +255,8 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"state": "PENDING",
|
||||
"updated_at": None,
|
||||
"created_at": None,
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditCreatePayload"
|
||||
},
|
||||
@@ -273,7 +279,7 @@ class TestAuditNotification(base.DbTestCase):
|
||||
self.assertDictEqual(
|
||||
{
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1",
|
||||
"watcher_object.version": "1.2",
|
||||
"watcher_object.data": {
|
||||
"interval": None,
|
||||
"next_run_time": None,
|
||||
@@ -316,7 +322,8 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"state": "DELETED",
|
||||
"updated_at": None,
|
||||
"created_at": "2016-10-18T09:52:05Z",
|
||||
"audit_type": "ONESHOT"
|
||||
"audit_type": "ONESHOT",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditDeletePayload"
|
||||
},
|
||||
@@ -386,11 +393,12 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"watcher_object.version": "1.0"
|
||||
},
|
||||
"updated_at": None,
|
||||
"uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d"
|
||||
"uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditActionPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
@@ -473,11 +481,12 @@ class TestAuditNotification(base.DbTestCase):
|
||||
"watcher_object.version": "1.0"
|
||||
},
|
||||
"updated_at": None,
|
||||
"uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d"
|
||||
"uuid": "10a47dd1-4874-4298-91cf-eff046dbdb8d",
|
||||
"status_message": None
|
||||
},
|
||||
"watcher_object.name": "AuditActionPayload",
|
||||
"watcher_object.namespace": "watcher",
|
||||
"watcher_object.version": "1.1"
|
||||
"watcher_object.version": "1.2"
|
||||
}
|
||||
},
|
||||
notification
|
||||
|
||||
@@ -254,44 +254,44 @@ expected_notification_fingerprints = {
|
||||
'ExceptionNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ExceptionPayload': '1.0-4516ae282a55fe2fd5c754967ee6248b',
|
||||
'NotificationPublisher': '1.0-bbbc1402fb0e443a3eb227cc52b61545',
|
||||
'TerseAuditPayload': '1.2-0fda1751c39f29b539944c2b44690f65',
|
||||
'AuditPayload': '1.2-d30cc1639404ed380b0742b781db690e',
|
||||
'AuditStateUpdatePayload': '1.0-1a1b606bf14a2c468800c2b010801ce5',
|
||||
'TerseAuditPayload': '1.3-f4fa23834af600ae71b15e2eaff41dc4',
|
||||
'AuditPayload': '1.3-c6f2aa269a6ea020a0371ad4ac7236bb',
|
||||
'AuditStateUpdatePayload': '1.1-74b6a28fb14d1f8e9da6cc8a9033fbaf',
|
||||
'AuditUpdateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'AuditUpdatePayload': '1.1-e32c3f69c353d47948afa44359246828',
|
||||
'AuditUpdatePayload': '1.2-12970dec38cd622f7bb5670ac1c5dc1f',
|
||||
'AuditCreateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'AuditCreatePayload': '1.1-d30cc1639404ed380b0742b781db690e',
|
||||
'AuditCreatePayload': '1.2-c6f2aa269a6ea020a0371ad4ac7236bb',
|
||||
'AuditDeleteNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'AuditDeletePayload': '1.1-d30cc1639404ed380b0742b781db690e',
|
||||
'AuditDeletePayload': '1.2-c6f2aa269a6ea020a0371ad4ac7236bb',
|
||||
'AuditActionNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'AuditActionPayload': '1.1-3d19c75dd9cdf2a833d0367b234e20d2',
|
||||
'AuditActionPayload': '1.2-1558683dda8c4d947878cd721db6c50c',
|
||||
'GoalPayload': '1.0-fa1fecb8b01dd047eef808ded4d50d1a',
|
||||
'StrategyPayload': '1.0-94f01c137b083ac236ae82573c1fcfc1',
|
||||
'ActionPlanActionPayload': '1.1-5be9fa7ca9e544322bdded5593e36edb',
|
||||
'ActionPlanActionPayload': '1.2-9c2a2ddf6128b3ea1ad95d2fc965fdd1',
|
||||
'ActionPlanCreateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionPlanCreatePayload': '1.1-6a3c3bf1d1f822e33633c49088699d4e',
|
||||
'ActionPlanCreatePayload': '1.2-d5a0360b23d976d66bc8d572a54177f2',
|
||||
'ActionPlanDeleteNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionPlanDeletePayload': '1.1-6a3c3bf1d1f822e33633c49088699d4e',
|
||||
'ActionPlanPayload': '1.1-6a3c3bf1d1f822e33633c49088699d4e',
|
||||
'ActionPlanStateUpdatePayload': '1.0-1a1b606bf14a2c468800c2b010801ce5',
|
||||
'ActionPlanDeletePayload': '1.2-d5a0360b23d976d66bc8d572a54177f2',
|
||||
'ActionPlanPayload': '1.2-d5a0360b23d976d66bc8d572a54177f2',
|
||||
'ActionPlanStateUpdatePayload': '1.1-74b6a28fb14d1f8e9da6cc8a9033fbaf',
|
||||
'ActionPlanUpdateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionPlanUpdatePayload': '1.1-4ecd6571784cec2656725003ce431fdd',
|
||||
'ActionPlanUpdatePayload': '1.2-29d6519e04e7fa041b6b732bc2a8638a',
|
||||
'ActionPlanActionNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionPlanCancelNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionCancelNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionCreateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionCreatePayload': '1.0-519b93b7450319d8928b4b6e6362df31',
|
||||
'ActionCreatePayload': '1.1-2ac8ce2b37757c7bbb5c794f2021d4ce',
|
||||
'ActionDeleteNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionDeletePayload': '1.0-519b93b7450319d8928b4b6e6362df31',
|
||||
'ActionDeletePayload': '1.1-2ac8ce2b37757c7bbb5c794f2021d4ce',
|
||||
'ActionExecutionNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionExecutionPayload': '1.0-bff9f820a2abf7bb6d7027b7450157df',
|
||||
'ActionPayload': '1.0-519b93b7450319d8928b4b6e6362df31',
|
||||
'ActionStateUpdatePayload': '1.0-1a1b606bf14a2c468800c2b010801ce5',
|
||||
'ActionExecutionPayload': '1.1-b1932d855cc2081d45de50e9705c77fd',
|
||||
'ActionPayload': '1.1-2ac8ce2b37757c7bbb5c794f2021d4ce',
|
||||
'ActionStateUpdatePayload': '1.1-74b6a28fb14d1f8e9da6cc8a9033fbaf',
|
||||
'ActionUpdateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ActionUpdatePayload': '1.0-03306c7e7f4d49ac328c261eff6b30b8',
|
||||
'ActionPlanCancelPayload': '1.1-5be9fa7ca9e544322bdded5593e36edb',
|
||||
'ActionCancelPayload': '1.0-bff9f820a2abf7bb6d7027b7450157df',
|
||||
'TerseActionPlanPayload': '1.1-63008f013817407df9194c2a59fda6b0',
|
||||
'ActionUpdatePayload': '1.1-97da2932212857c4340e9d114dfd8985',
|
||||
'ActionPlanCancelPayload': '1.2-9c2a2ddf6128b3ea1ad95d2fc965fdd1',
|
||||
'ActionCancelPayload': '1.1-b1932d855cc2081d45de50e9705c77fd',
|
||||
'TerseActionPlanPayload': '1.2-4c63201dc30b407be0e39be2aecc3f2b',
|
||||
'ServiceUpdateNotification': '1.0-9b69de0724fda8310d05e18418178866',
|
||||
'ServicePayload': '1.0-9c5a9bc51e6606e0ec3cf95baf698f4f',
|
||||
'ServiceStatusUpdatePayload': '1.0-1a1b606bf14a2c468800c2b010801ce5',
|
||||
|
||||
@@ -172,7 +172,8 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
||||
self.fake_audit = utils.create_test_audit()
|
||||
self.fake_action_plan = utils.create_test_action_plan()
|
||||
self.fake_action = utils.get_test_action(
|
||||
created_at=timeutils.utcnow())
|
||||
created_at=timeutils.utcnow(),
|
||||
status_message="Fake status message")
|
||||
|
||||
@mock.patch.object(db_api.Connection, 'create_action')
|
||||
def test_create(self, mock_create_action):
|
||||
@@ -184,6 +185,7 @@ class TestCreateDeleteActionObject(base.DbTestCase):
|
||||
tzinfo=datetime.timezone.utc)
|
||||
mock_create_action.assert_called_once_with(expected_action)
|
||||
self.assertEqual(self.context, action._context)
|
||||
self.assertEqual("Fake status message", action.status_message)
|
||||
|
||||
@mock.patch.object(notifications.action, 'send_delete')
|
||||
@mock.patch.object(notifications.action, 'send_update')
|
||||
|
||||
@@ -410,9 +410,9 @@ expected_object_fingerprints = {
|
||||
'Goal': '1.0-93881622db05e7b67a65ca885b4a022e',
|
||||
'Strategy': '1.1-73f164491bdd4c034f48083a51bdeb7b',
|
||||
'AuditTemplate': '1.1-b291973ffc5efa2c61b24fe34fdccc0b',
|
||||
'Audit': '1.7-19bc991c0b048263df021a36c8624f4d',
|
||||
'ActionPlan': '2.2-3331270cb3666c93408934826d03c08d',
|
||||
'Action': '2.0-1dd4959a7e7ac30c62ef170fe08dd935',
|
||||
'Audit': '1.8-9cadb11a1fbe7200fb32891b37672a62',
|
||||
'ActionPlan': '2.3-dad26bdb60307f461572739463108a59',
|
||||
'Action': '2.1-71073c74c2ecc3a3d7c7103d0072d366',
|
||||
'EfficacyIndicator': '1.0-655b71234a82bc7478aff964639c4bb0',
|
||||
'ScoringEngine': '1.0-4abbe833544000728e17bd9e83f97576',
|
||||
'Service': '1.0-4b35b99ada9677a882c9de2b30212f35',
|
||||
|
||||
Reference in New Issue
Block a user