Fixed tense consistency (used past) in statuses
In several places in Watcher, there are statuses which corresponds to a status in the respective life cycle. There were used past tense everywhere, except "SUCCESS" which was written in present tense. So I searched for all the occurences of this state, and replaced them with their past tense form. Change-Id: Ic41def96d1a608da06a1e394e24704d4f06ab32a Closes-Bug: #1520276
This commit is contained in:
@@ -64,7 +64,7 @@ class CommandExecutor(object):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.deploy.populate(primitive)
|
self.deploy.populate(primitive)
|
||||||
self.notify(action, Status.SUCCESS)
|
self.notify(action, Status.SUCCEEDED)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
'The applier module failed to execute the action{0} with '
|
'The applier module failed to execute the action{0} with '
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class LaunchActionPlanCommand(ApplierCommand):
|
|||||||
LOG.error("Launch Action Plan " + unicode(e))
|
LOG.error("Launch Action Plan " + unicode(e))
|
||||||
finally:
|
finally:
|
||||||
if result is True:
|
if result is True:
|
||||||
status = Status.SUCCESS
|
status = Status.SUCCEEDED
|
||||||
else:
|
else:
|
||||||
status = Status.FAILED
|
status = Status.FAILED
|
||||||
# update state
|
# update state
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ class TriggerAuditCommand(BaseDecisionEngineCommand):
|
|||||||
planner = DefaultPlanner()
|
planner = DefaultPlanner()
|
||||||
planner.schedule(request_context, audit.id, solution)
|
planner.schedule(request_context, audit.id, solution)
|
||||||
|
|
||||||
# 7 - change status to SUCCESS and notify
|
# 7 - change status to SUCCEEDED and notify
|
||||||
self.update_audit(request_context, audit_uuid, AuditStatus.SUCCESS)
|
self.update_audit(request_context, audit_uuid,
|
||||||
|
AuditStatus.SUCCEEDED)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.update_audit(request_context, audit_uuid, AuditStatus.FAILED)
|
self.update_audit(request_context, audit_uuid, AuditStatus.FAILED)
|
||||||
LOG.error("Execute audit command {0} ".format(unicode(e)))
|
LOG.error("Execute audit command {0} ".format(unicode(e)))
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Status(object):
|
|||||||
PENDING = 'PENDING'
|
PENDING = 'PENDING'
|
||||||
ONGOING = 'ONGOING'
|
ONGOING = 'ONGOING'
|
||||||
FAILED = 'FAILED'
|
FAILED = 'FAILED'
|
||||||
SUCCESS = 'SUCCESS'
|
SUCCEEDED = 'SUCCEEDED'
|
||||||
DELETED = 'DELETED'
|
DELETED = 'DELETED'
|
||||||
CANCELLED = 'CANCELLED'
|
CANCELLED = 'CANCELLED'
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Status(object):
|
|||||||
RECOMMENDED = 'RECOMMENDED'
|
RECOMMENDED = 'RECOMMENDED'
|
||||||
ONGOING = 'ONGOING'
|
ONGOING = 'ONGOING'
|
||||||
FAILED = 'FAILED'
|
FAILED = 'FAILED'
|
||||||
SUCCESS = 'SUCCESS'
|
SUCCEEDED = 'SUCCEEDED'
|
||||||
DELETED = 'DELETED'
|
DELETED = 'DELETED'
|
||||||
CANCELLED = 'CANCELLED'
|
CANCELLED = 'CANCELLED'
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from watcher.objects import utils as obj_utils
|
|||||||
|
|
||||||
class AuditStatus(object):
|
class AuditStatus(object):
|
||||||
ONGOING = 'ONGOING'
|
ONGOING = 'ONGOING'
|
||||||
SUCCESS = 'SUCCESS'
|
SUCCEEDED = 'SUCCEEDED'
|
||||||
SUBMITTED = 'SUBMITTED'
|
SUBMITTED = 'SUBMITTED'
|
||||||
FAILED = 'FAILED'
|
FAILED = 'FAILED'
|
||||||
CANCELLED = 'CANCELLED'
|
CANCELLED = 'CANCELLED'
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||||||
self.assertTrue(response.json['error_message'])
|
self.assertTrue(response.json['error_message'])
|
||||||
|
|
||||||
def test_add_ok(self):
|
def test_add_ok(self):
|
||||||
new_state = 'SUCCESS'
|
new_state = 'SUCCEEDED'
|
||||||
response = self.patch_json(
|
response = self.patch_json(
|
||||||
'/actions/%s' % self.action.uuid,
|
'/actions/%s' % self.action.uuid,
|
||||||
[{'path': '/state', 'value': new_state, 'op': 'add'}])
|
[{'path': '/state', 'value': new_state, 'op': 'add'}])
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||||||
self.assertTrue(response.json['error_message'])
|
self.assertTrue(response.json['error_message'])
|
||||||
|
|
||||||
def test_add_ok(self):
|
def test_add_ok(self):
|
||||||
new_state = 'SUCCESS'
|
new_state = 'SUCCEEDED'
|
||||||
response = self.patch_json(
|
response = self.patch_json(
|
||||||
'/audits/%s' % self.audit.uuid,
|
'/audits/%s' % self.audit.uuid,
|
||||||
[{'path': '/state', 'value': new_state, 'op': 'add'}])
|
[{'path': '/state', 'value': new_state, 'op': 'add'}])
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TestLaunchActionPlanCommand(DbTestCase):
|
|||||||
command.execute()
|
command.execute()
|
||||||
action_plan = ActionPlan.get_by_uuid(self.context,
|
action_plan = ActionPlan.get_by_uuid(self.context,
|
||||||
self.action_plan.uuid)
|
self.action_plan.uuid)
|
||||||
self.assertEqual(Status.SUCCESS, action_plan.state)
|
self.assertEqual(Status.SUCCEEDED, action_plan.state)
|
||||||
|
|
||||||
def test_trigger_audit_send_notification(self):
|
def test_trigger_audit_send_notification(self):
|
||||||
messaging = MagicMock()
|
messaging = MagicMock()
|
||||||
@@ -63,10 +63,10 @@ class TestLaunchActionPlanCommand(DbTestCase):
|
|||||||
call_on_going = call(Events.LAUNCH_ACTION_PLAN.name, {
|
call_on_going = call(Events.LAUNCH_ACTION_PLAN.name, {
|
||||||
'action_plan_status': Status.ONGOING,
|
'action_plan_status': Status.ONGOING,
|
||||||
'action_plan__uuid': self.action_plan.uuid})
|
'action_plan__uuid': self.action_plan.uuid})
|
||||||
call_success = call(Events.LAUNCH_ACTION_PLAN.name, {
|
call_succeeded = call(Events.LAUNCH_ACTION_PLAN.name, {
|
||||||
'action_plan_status': Status.SUCCESS,
|
'action_plan_status': Status.SUCCEEDED,
|
||||||
'action_plan__uuid': self.action_plan.uuid})
|
'action_plan__uuid': self.action_plan.uuid})
|
||||||
|
|
||||||
calls = [call_on_going, call_success]
|
calls = [call_on_going, call_succeeded]
|
||||||
messaging.topic_status.publish_event.assert_has_calls(calls)
|
messaging.topic_status.publish_event.assert_has_calls(calls)
|
||||||
self.assertEqual(2, messaging.topic_status.publish_event.call_count)
|
self.assertEqual(2, messaging.topic_status.publish_event.call_count)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class TestTriggerAuditCommand(DbTestCase):
|
|||||||
command.strategy_context.execute_strategy = MagicMock()
|
command.strategy_context.execute_strategy = MagicMock()
|
||||||
command.execute(self.audit.uuid, self.context)
|
command.execute(self.audit.uuid, self.context)
|
||||||
audit = Audit.get_by_uuid(self.context, self.audit.uuid)
|
audit = Audit.get_by_uuid(self.context, self.audit.uuid)
|
||||||
self.assertEqual(AuditStatus.SUCCESS, audit.state)
|
self.assertEqual(AuditStatus.SUCCEEDED, audit.state)
|
||||||
|
|
||||||
def test_trigger_audit_send_notification(self):
|
def test_trigger_audit_send_notification(self):
|
||||||
messaging = MagicMock()
|
messaging = MagicMock()
|
||||||
@@ -62,10 +62,10 @@ class TestTriggerAuditCommand(DbTestCase):
|
|||||||
call_on_going = call(Events.TRIGGER_AUDIT.name, {
|
call_on_going = call(Events.TRIGGER_AUDIT.name, {
|
||||||
'audit_status': AuditStatus.ONGOING,
|
'audit_status': AuditStatus.ONGOING,
|
||||||
'audit_uuid': self.audit.uuid})
|
'audit_uuid': self.audit.uuid})
|
||||||
call_success = call(Events.TRIGGER_AUDIT.name, {
|
call_succeeded = call(Events.TRIGGER_AUDIT.name, {
|
||||||
'audit_status': AuditStatus.SUCCESS,
|
'audit_status': AuditStatus.SUCCEEDED,
|
||||||
'audit_uuid': self.audit.uuid})
|
'audit_uuid': self.audit.uuid})
|
||||||
|
|
||||||
calls = [call_on_going, call_success]
|
calls = [call_on_going, call_succeeded]
|
||||||
messaging.topic_status.publish_event.assert_has_calls(calls)
|
messaging.topic_status.publish_event.assert_has_calls(calls)
|
||||||
self.assertEqual(2, messaging.topic_status.publish_event.call_count)
|
self.assertEqual(2, messaging.topic_status.publish_event.call_count)
|
||||||
|
|||||||
@@ -93,12 +93,12 @@ class TestActionObject(base.DbTestCase):
|
|||||||
with mock.patch.object(self.dbapi, 'update_action',
|
with mock.patch.object(self.dbapi, 'update_action',
|
||||||
autospec=True) as mock_update_action:
|
autospec=True) as mock_update_action:
|
||||||
action = objects.Action.get_by_uuid(self.context, uuid)
|
action = objects.Action.get_by_uuid(self.context, uuid)
|
||||||
action.state = 'SUCCESS'
|
action.state = 'SUCCEEDED'
|
||||||
action.save()
|
action.save()
|
||||||
|
|
||||||
mock_get_action.assert_called_once_with(self.context, uuid)
|
mock_get_action.assert_called_once_with(self.context, uuid)
|
||||||
mock_update_action.assert_called_once_with(
|
mock_update_action.assert_called_once_with(
|
||||||
uuid, {'state': 'SUCCESS'})
|
uuid, {'state': 'SUCCEEDED'})
|
||||||
self.assertEqual(self.context, action._context)
|
self.assertEqual(self.context, action._context)
|
||||||
|
|
||||||
def test_refresh(self):
|
def test_refresh(self):
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ class TestActionPlanObject(base.DbTestCase):
|
|||||||
autospec=True) as mock_update_action_plan:
|
autospec=True) as mock_update_action_plan:
|
||||||
action_plan = objects.ActionPlan.get_by_uuid(
|
action_plan = objects.ActionPlan.get_by_uuid(
|
||||||
self.context, uuid)
|
self.context, uuid)
|
||||||
action_plan.state = 'SUCCESS'
|
action_plan.state = 'SUCCEEDED'
|
||||||
action_plan.save()
|
action_plan.save()
|
||||||
|
|
||||||
mock_get_action_plan.assert_called_once_with(
|
mock_get_action_plan.assert_called_once_with(
|
||||||
self.context, uuid)
|
self.context, uuid)
|
||||||
mock_update_action_plan.assert_called_once_with(
|
mock_update_action_plan.assert_called_once_with(
|
||||||
uuid, {'state': 'SUCCESS'})
|
uuid, {'state': 'SUCCEEDED'})
|
||||||
self.assertEqual(self.context, action_plan._context)
|
self.assertEqual(self.context, action_plan._context)
|
||||||
|
|
||||||
def test_refresh(self):
|
def test_refresh(self):
|
||||||
|
|||||||
@@ -93,12 +93,12 @@ class TestAuditObject(base.DbTestCase):
|
|||||||
with mock.patch.object(self.dbapi, 'update_audit',
|
with mock.patch.object(self.dbapi, 'update_audit',
|
||||||
autospec=True) as mock_update_audit:
|
autospec=True) as mock_update_audit:
|
||||||
audit = objects.Audit.get_by_uuid(self.context, uuid)
|
audit = objects.Audit.get_by_uuid(self.context, uuid)
|
||||||
audit.state = 'SUCCESS'
|
audit.state = 'SUCCEEDED'
|
||||||
audit.save()
|
audit.save()
|
||||||
|
|
||||||
mock_get_audit.assert_called_once_with(self.context, uuid)
|
mock_get_audit.assert_called_once_with(self.context, uuid)
|
||||||
mock_update_audit.assert_called_once_with(
|
mock_update_audit.assert_called_once_with(
|
||||||
uuid, {'state': 'SUCCESS'})
|
uuid, {'state': 'SUCCEEDED'})
|
||||||
self.assertEqual(self.context, audit._context)
|
self.assertEqual(self.context, audit._context)
|
||||||
|
|
||||||
def test_refresh(self):
|
def test_refresh(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user