Unify event module import

This patch unifies the import of the event module so that it appears the
same wherever it is called. The intent is to make searching for such an
invocation easier.

Change-Id: I2a31e1918cc6207f01838ee6ab85a1affbc92cd0
This commit is contained in:
tengqm 2016-02-11 03:37:32 -05:00
parent 5f232416ae
commit 6bb650e8f2
11 changed files with 90 additions and 90 deletions

View File

@ -21,7 +21,7 @@ from senlin.common.i18n import _
from senlin.common.i18n import _LE
from senlin.drivers import base
from senlin.drivers.openstack import neutron_v2 as neutronclient
from senlin.engine import event
from senlin.engine import event as EVENT
LOG = logging.getLogger(__name__)
@ -60,7 +60,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in getting loadbalancer: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'LB_GET',
EVENT.warning(oslo_context.get_current(), self, 'LB_GET',
'ERROR', msg)
return False
if lb is None:
@ -98,7 +98,7 @@ class LoadBalancerDriver(base.DriverBase):
except exception.InternalError as ex:
msg = _LE('Failed in getting subnet: %s.') % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'SUBNET_GET',
EVENT.warning(oslo_context.get_current(), self, 'SUBNET_GET',
'ERROR', msg)
return False, msg
subnet_id = subnet.id
@ -110,7 +110,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in creating loadbalancer: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'LB_CREATE',
EVENT.warning(oslo_context.get_current(), self, 'LB_CREATE',
'ERROR', msg)
return False, msg
result['loadbalancer'] = lb.id
@ -132,7 +132,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in creating lb listener: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'LISTENER_CREATE',
EVENT.warning(oslo_context.get_current(), self, 'LISTENER_CREATE',
'ERROR', msg)
return False, msg
result['listener'] = listener.id
@ -151,7 +151,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in creating lb pool: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'POOL_CREATE',
EVENT.warning(oslo_context.get_current(), self, 'POOL_CREATE',
'ERROR', msg)
return False, msg
result['pool'] = pool.id
@ -179,7 +179,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in deleting healthmonitor: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self,
EVENT.warning(oslo_context.get_current(), self,
'HEALTHMONITOR_DELETE', 'ERROR', msg)
return False, msg
res = self._wait_for_lb_ready(lb_id)
@ -196,7 +196,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in deleting lb pool: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self, 'POOL_DELETE',
EVENT.warning(oslo_context.get_current(), self, 'POOL_DELETE',
'ERROR', msg)
return False, msg
res = self._wait_for_lb_ready(lb_id)
@ -212,7 +212,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in deleting listener: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self,
EVENT.warning(oslo_context.get_current(), self,
'LISTENER_DELETE', 'ERROR', msg)
return False, msg
res = self._wait_for_lb_ready(lb_id)
@ -247,7 +247,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in getting %(resource)s: %(msg)s.'
) % {'resource': resource, 'msg': six.text_type(ex)}
LOG.exception(msg)
event.warning(oslo_context.get_current(), self,
EVENT.warning(oslo_context.get_current(), self,
resource.upper() + '_GET', 'ERROR', msg)
return None
net_name = net.name
@ -268,7 +268,7 @@ class LoadBalancerDriver(base.DriverBase):
msg = _LE('Failed in creating lb pool member: %s.'
) % six.text_type(ex)
LOG.exception(msg)
event.warning(oslo_context.get_current(), self,
EVENT.warning(oslo_context.get_current(), self,
'POOL_MEMBER_CREATE', 'ERROR', msg)
return None
res = self._wait_for_lb_ready(lb_id)
@ -293,7 +293,7 @@ class LoadBalancerDriver(base.DriverBase):
'%(ex)s') % {'m': member_id, 'p': pool_id,
'ex': six.text_type(ex)}
LOG.exception(msg)
event.warning(oslo_context.get_current(), self,
EVENT.warning(oslo_context.get_current(), self,
'POOL_MEMBER_DELETE', 'ERROR', msg)
return None
res = self._wait_for_lb_ready(lb_id)

View File

@ -21,7 +21,7 @@ from senlin.common.i18n import _LE
from senlin.common import utils
from senlin.db import api as db_api
from senlin.engine import cluster_policy as cp_mod
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.engine import node as node_mod
from senlin.policies import base as policy_base
from senlin.profiles import base as profile_base
@ -141,13 +141,13 @@ class Cluster(object):
if self.id:
values['updated_at'] = timestamp
db_api.cluster_update(context, self.id, values)
event_mod.info(context, self, 'update')
EVENT.info(context, self, 'update')
else:
self.init_at = timestamp
values['init_at'] = timestamp
cluster = db_api.cluster_create(context, values)
self.id = cluster.id
event_mod.info(context, self, 'create')
EVENT.info(context, self, 'create')
self._load_runtime_data(context)
return self.id

View File

@ -20,7 +20,7 @@ from senlin.common.i18n import _
from senlin.common.i18n import _LE
from senlin.common import utils
from senlin.db import api as db_api
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.profiles import base as profile_base
LOG = logging.getLogger(__name__)
@ -122,13 +122,13 @@ class Node(object):
if self.id:
db_api.node_update(context, self.id, values)
event_mod.info(context, self, 'update')
EVENT.info(context, self, 'update')
else:
init_at = timeutils.utcnow()
self.init_at = init_at
values['init_at'] = init_at
node = db_api.node_create(context, values)
event_mod.info(context, self, 'create')
EVENT.info(context, self, 'create')
self.id = node.id
self._load_runtime_data(context)
@ -233,7 +233,7 @@ class Node(object):
def _handle_exception(self, context, action, status, exception):
msg = six.text_type(exception)
event_mod.warning(context, self, action, status, msg)
EVENT.warning(context, self, action, status, msg)
self.physical_id = exception.kwargs.get('resource_id', None)
if self.physical_id:
reason = _('Profile failed in %(action)s resource (%(id)s) due '
@ -251,7 +251,7 @@ class Node(object):
LOG.error(_LE('Node is in status "%s"'), self.status)
return False
self.set_status(context, self.CREATING, reason='Creation in progress')
event_mod.info(context, self, 'create')
EVENT.info(context, self, 'create')
try:
physical_id = profile_base.Profile.create_object(context, self)
except exception.InternalError as ex:
@ -275,7 +275,7 @@ class Node(object):
# TODO(Qiming): check if actions are working on it and can be canceled
self.set_status(context, self.DELETING, reason='Deletion in progress')
event_mod.info(context, self, 'delete')
EVENT.info(context, self, 'delete')
try:
res = profile_base.Profile.delete_object(context, self)
except exception.ResourceStatusError as ex:

View File

@ -39,7 +39,7 @@ from senlin.engine import cluster as cluster_mod
from senlin.engine import cluster_policy
from senlin.engine import dispatcher
from senlin.engine import environment
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.engine import health_manager
from senlin.engine import node as node_mod
from senlin.engine import receiver as receiver_mod
@ -1785,10 +1785,10 @@ class EngineService(service.Service):
@request_context
def event_list(self, context, filters=None, limit=None, marker=None,
sort=None, project_safe=True):
all_events = event_mod.Event.load_all(context, filters=filters,
limit=limit, marker=marker,
sort=sort,
project_safe=project_safe)
all_events = EVENT.Event.load_all(context, filters=filters,
limit=limit, marker=marker,
sort=sort,
project_safe=project_safe)
results = [event.to_dict() for event in all_events]
return results
@ -1796,5 +1796,5 @@ class EngineService(service.Service):
@request_context
def event_get(self, context, identity):
db_event = self.event_find(context, identity)
event = event_mod.Event.load(context, db_event=db_event)
event = EVENT.Event.load(context, db_event=db_event)
return event.to_dict()

View File

@ -19,7 +19,7 @@ from senlin.common import exception
from senlin.common.i18n import _
from senlin.drivers.openstack import lbaas
from senlin.drivers.openstack import neutron_v2
from senlin.engine import event
from senlin.engine import event as EVENT
from senlin.tests.unit.common import base
from senlin.tests.unit.common import utils
@ -144,7 +144,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.lb_driver._wait_for_lb_ready.assert_has_calls(
calls, any_order=False)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_lb_create_loadbalancer_creation_failed(self, mock_event):
lb_obj = mock.Mock()
lb_obj.id = 'LB_ID'
@ -187,7 +187,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.assertEqual(msg, res)
self.assertTrue(mock_event.called)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
@mock.patch.object(eventlet, 'sleep')
def test_lb_create_listener_creation_failed(self, mock_sleep, mock_event):
lb_obj = mock.Mock()
@ -230,7 +230,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.assertEqual(msg, res)
self.assertTrue(mock_event.called)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_lb_create_pool_creation_failed(self, mock_event):
lb_obj = mock.Mock()
listener_obj = mock.Mock()
@ -299,7 +299,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.lb_driver._wait_for_lb_ready.assert_has_calls(
calls, any_order=False)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_lb_healthmonitor_delete_internalerror(self, mock_event):
kwargs = {
'loadbalancer': 'LB_ID',
@ -315,7 +315,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.assertEqual(msg, res)
self.assertTrue(mock_event.called)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_lb_pool_delete_internalerror(self, mock_event):
kwargs = {
'loadbalancer': 'LB_ID',
@ -333,7 +333,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.assertEqual(msg, res)
self.assertTrue(mock_event.called)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_lb_listener_delete_internalerror(self, mock_event):
kwargs = {
'loadbalancer': 'LB_ID',
@ -366,7 +366,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.lb_driver._wait_for_lb_ready.assert_called_once_with(
'LB_ID', ignore_not_found=True)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
@mock.patch.object(oslo_context, 'get_current')
def test_member_add(self, mock_get_current, mock_event):
node = mock.Mock()
@ -471,7 +471,7 @@ class TestNeutronLBaaSDriver(base.SenlinTestCase):
self.nc.pool_member_delete.assert_called_once_with(pool_id, member_id)
self.lb_driver._wait_for_lb_ready.assert_called_once_with(lb_id)
@mock.patch.object(event, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_member_remove_failed(self, mock_event):
lb_id = 'LB_ID'
pool_id = 'POOL_ID'

View File

@ -23,7 +23,7 @@ from senlin.engine.actions import base as action_base
from senlin.engine import cluster as cluster_mod
from senlin.engine import cluster_policy as cp_mod
from senlin.engine import environment
from senlin.engine import event
from senlin.engine import event as EVENT
from senlin.engine import node as node_mod
from senlin.policies import base as policy_mod
from senlin.tests.unit.common import base
@ -306,7 +306,7 @@ class ActionBaseTest(base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(db_api, 'action_signal')
@mock.patch.object(event, 'error')
@mock.patch.object(EVENT, 'error')
def test_action_signal_cancel(self, mock_error, mock_call):
values = copy.deepcopy(self.action_values)
action = action_base.Action('OBJID', 'OBJECT_ACTION', self.ctx,
@ -333,7 +333,7 @@ class ActionBaseTest(base.SenlinTestCase):
mock_error.reset_mock()
@mock.patch.object(db_api, 'action_signal')
@mock.patch.object(event, 'error')
@mock.patch.object(EVENT, 'error')
def test_action_signal_suspend(self, mock_error, mock_call):
action = action_base.Action('OBJID', 'OBJECT_ACTION', self.ctx)
@ -357,7 +357,7 @@ class ActionBaseTest(base.SenlinTestCase):
mock_error.reset_mock()
@mock.patch.object(db_api, 'action_signal')
@mock.patch.object(event, 'error')
@mock.patch.object(EVENT, 'error')
def test_action_signal_resume(self, mock_error, mock_call):
action = action_base.Action('OBJID', 'OBJECT_ACTION', self.ctx)
@ -799,7 +799,7 @@ class ActionProcTest(base.SenlinTestCase):
self.ctx = utils.dummy_context()
@mock.patch.object(event, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(action_base.Action, 'load')
@mock.patch.object(db_api, 'action_mark_succeeded')
def test_action_proc_successful(self, mock_mark, mock_load,
@ -820,7 +820,7 @@ class ActionProcTest(base.SenlinTestCase):
self.assertEqual(123456, action.start_time)
self.assertEqual('BIG SUCCESS', action.status_reason)
@mock.patch.object(event, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(action_base.Action, 'load')
@mock.patch.object(db_api, 'action_mark_failed')
def test_action_proc_failed_error(self, mock_mark, mock_load,

View File

@ -20,7 +20,7 @@ from senlin.engine.actions import base as base_action
from senlin.engine.actions import cluster_action as ca
from senlin.engine import cluster as cluster_mod
from senlin.engine import dispatcher
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.engine import node as node_mod
from senlin.engine import scheduler
from senlin.engine import senlin_lock
@ -2065,7 +2065,7 @@ class ClusterActionTest(base.SenlinTestCase):
mock.call('FAKE_CLUSTER', 'BEFORE'),
mock.call('FAKE_CLUSTER', 'AFTER')])
@mock.patch.object(event_mod, 'error')
@mock.patch.object(EVENT, 'error')
@mock.patch.object(base_action.Action, 'policy_check')
def test_execute_failed_policy_check(self, mock_check, mock_error,
mock_load):
@ -2088,7 +2088,7 @@ class ClusterActionTest(base.SenlinTestCase):
action.context, cluster, 'CLUSTER_FLY', 'Failed',
'Policy check failure: Something is wrong.')
@mock.patch.object(event_mod, 'error')
@mock.patch.object(EVENT, 'error')
@mock.patch.object(base_action.Action, 'policy_check')
def test_execute_unsupported_action(self, mock_check, mock_error,
mock_load):
@ -2110,7 +2110,7 @@ class ClusterActionTest(base.SenlinTestCase):
action.context, cluster, 'CLUSTER_DANCE', 'Failed',
'Unsupported action: CLUSTER_DANCE.')
@mock.patch.object(event_mod, 'error')
@mock.patch.object(EVENT, 'error')
def test_execute_post_check_failed(self, mock_error, mock_load):
def fake_check(cluster_id, target):
if target == 'BEFORE':

View File

@ -16,7 +16,7 @@ from senlin.common import scaleutils
from senlin.engine.actions import base as base_action
from senlin.engine.actions import node_action
from senlin.engine import cluster as cluster_mod
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.engine import node as node_mod
from senlin.engine import senlin_lock as lock
from senlin.policies import base as policy_mod
@ -359,7 +359,7 @@ class NodeActionTest(base.SenlinTestCase):
self.assertEqual('GOOD', res_msg)
action.do_sing.assert_called_once_with()
@mock.patch.object(event_mod, 'error')
@mock.patch.object(EVENT, 'error')
def test_execute_bad_action(self, mock_error, mock_load):
node = mock.Mock()
node.id = 'NID'

View File

@ -13,7 +13,7 @@
from oslo_utils import timeutils
from senlin.common import exception
from senlin.engine import event as event_mod
from senlin.engine import event as EVENT
from senlin.engine import service
from senlin.tests.unit.common import base
from senlin.tests.unit.common import utils
@ -29,9 +29,9 @@ class EventTest(base.SenlinTestCase):
def test_event_list(self):
ts = timeutils.utcnow()
e1 = event_mod.Event(ts, 50, status='GOOD', context=self.ctx)
e1 = EVENT.Event(ts, 50, status='GOOD', context=self.ctx)
eid1 = e1.store(self.ctx)
e2 = event_mod.Event(ts, 50, status='BAD', context=self.ctx)
e2 = EVENT.Event(ts, 50, status='BAD', context=self.ctx)
eid2 = e2.store(self.ctx)
result = self.eng.event_list(self.ctx)
@ -45,11 +45,11 @@ class EventTest(base.SenlinTestCase):
self.assertIn(eid2, ids)
def test_event_list_with_limit_marker(self):
e1 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1.store(self.ctx)
e2 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e2 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e2.store(self.ctx)
result = self.eng.event_list(self.ctx, limit=0)
@ -67,8 +67,8 @@ class EventTest(base.SenlinTestCase):
result = self.eng.event_list(self.ctx, marker=e2.id)
self.assertEqual(0, len(result))
e3 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e3 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e3.store(self.ctx)
result = self.eng.event_list(self.ctx, limit=1, marker=e1.id)
self.assertEqual(1, len(result))
@ -76,14 +76,14 @@ class EventTest(base.SenlinTestCase):
self.assertEqual(2, len(result))
def test_event_list_with_sorting(self):
e1 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1.store(self.ctx)
e2 = event_mod.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2 = EVENT.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2.store(self.ctx)
e3 = event_mod.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3 = EVENT.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3.store(self.ctx)
# default by timestamp
@ -111,14 +111,14 @@ class EventTest(base.SenlinTestCase):
self.assertIsNotNone(result)
def test_event_list_with_sorting_dir(self):
e1 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1.store(self.ctx)
e2 = event_mod.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2 = EVENT.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2.store(self.ctx)
e3 = event_mod.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3 = EVENT.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3.store(self.ctx)
# default by timestamp , ascending
@ -136,14 +136,14 @@ class EventTest(base.SenlinTestCase):
self.assertEqual(e3.id, result[2]['id'])
def test_event_list_with_filters(self):
e1 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1.store(self.ctx)
e2 = event_mod.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2 = EVENT.Event(timeutils.utcnow(), 40, status='GOOD',
context=self.ctx)
e2.store(self.ctx)
e3 = event_mod.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3 = EVENT.Event(timeutils.utcnow(), 60, status='BAD',
context=self.ctx)
e3.store(self.ctx)
result = self.eng.event_list(self.ctx, filters={'level': 50})
@ -162,8 +162,8 @@ class EventTest(base.SenlinTestCase):
self.assertEqual(0, len(result))
def test_event_find(self):
e1 = event_mod.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
e1 = EVENT.Event(timeutils.utcnow(), 50, status='GOOD',
context=self.ctx)
eid = e1.store(self.ctx)
result = self.eng.event_find(self.ctx, eid)

View File

@ -18,7 +18,7 @@ from senlin.common import exception
from senlin.db.sqlalchemy import api as db_api
from senlin.engine import cluster as clusterm
from senlin.engine import cluster_policy as cp_mod
from senlin.engine import event as eventm
from senlin.engine import event as EVENT
from senlin.engine import node as node_mod
from senlin.policies import base as policy_base
from senlin.profiles import base as profile_base
@ -120,7 +120,7 @@ class TestCluster(base.SenlinTestCase):
self.assertEqual([], cluster.rt['policies'])
def test_store_for_create(self):
mock_info = self.patchobject(eventm, 'info')
mock_info = self.patchobject(EVENT, 'info')
cluster = clusterm.Cluster('test-cluster', 0, 'PROFILE_ID',
user=self.context.user,
@ -158,7 +158,7 @@ class TestCluster(base.SenlinTestCase):
mock_info.assert_called_once_with(self.context, cluster, 'create')
def test_store_for_update(self):
mock_info = self.patchobject(eventm, 'info')
mock_info = self.patchobject(EVENT, 'info')
cluster = clusterm.Cluster('test-cluster', 0, 'PROFILE_ID',
user=self.context.user,

View File

@ -19,7 +19,7 @@ from senlin.common import exception
from senlin.common.i18n import _
from senlin.common import utils as common_utils
from senlin.db.sqlalchemy import api as db_api
from senlin.engine import event as eventm
from senlin.engine import event as EVENT
from senlin.engine import node as nodem
from senlin.profiles import base as profiles_base
from senlin.tests.unit.common import base
@ -100,7 +100,7 @@ class TestNode(base.SenlinTestCase):
self.assertIsNotNone(node.name)
self.assertEqual(13, len(node.name))
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
def test_node_store_init(self, mock_info):
node = nodem.Node('node1', self.profile.id, self.cluster.id,
self.context, role='first_node',
@ -132,7 +132,7 @@ class TestNode(base.SenlinTestCase):
mock_info.assert_called_once_with(self.context, node, 'create')
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
def test_node_store_update(self, mock_info):
node = nodem.Node('node1', self.profile.id, None)
node_id = node.store(self.context)
@ -325,7 +325,7 @@ class TestNode(base.SenlinTestCase):
mock_details.assert_called_once_with(self.context, node)
self.assertEqual({'foo': 'bar'}, res)
@mock.patch.object(eventm, 'warning')
@mock.patch.object(EVENT, 'warning')
def test_node_handle_exception(self, mock_warning):
ex = exception.ResourceStatusError(resource_id='FAKE_ID',
status='FAKE_STATUS',
@ -357,7 +357,7 @@ class TestNode(base.SenlinTestCase):
mock_warning.assert_called_with(self.context, node, 'CREATE',
'STATUS', six.text_type(ex))
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(nodem.Node, 'store')
@mock.patch.object(nodem.Node, 'set_status')
@mock.patch.object(profiles_base.Profile, 'create_object')
@ -384,7 +384,7 @@ class TestNode(base.SenlinTestCase):
res = node.do_create(self.context)
self.assertFalse(res)
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(nodem.Node, 'set_status')
@mock.patch.object(profiles_base.Profile, 'create_object')
def test_node_create_not_created(self, mock_create, mock_status,
@ -398,8 +398,8 @@ class TestNode(base.SenlinTestCase):
reason='Creation in progress')
mock_event.assert_called_once_with(self.context, node, 'create')
@mock.patch.object(eventm, 'warning')
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'warning')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(nodem.Node, 'store')
@mock.patch.object(nodem.Node, 'set_status')
@mock.patch.object(profiles_base.Profile, 'create_object')
@ -421,7 +421,7 @@ class TestNode(base.SenlinTestCase):
'msg': six.text_type(ex)}
mock_status.assert_any_call(self.context, node.ERROR, reason)
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(db_api, 'node_delete')
@mock.patch.object(nodem.Node, 'set_status')
@mock.patch.object(profiles_base.Profile, 'delete_object')
@ -449,7 +449,7 @@ class TestNode(base.SenlinTestCase):
self.assertFalse(mock_delete.called)
self.assertTrue(mock_db_delete.called)
@mock.patch.object(eventm, 'info')
@mock.patch.object(EVENT, 'info')
@mock.patch.object(nodem.Node, '_handle_exception')
@mock.patch.object(nodem.Node, 'set_status')
@mock.patch.object(profiles_base.Profile, 'delete_object')