Cleanup exception logging
LOG.exception adds traceback and exception information automatically, so we don't need to add it explicitly. Change-Id: I58ea46917b84c7d0ec72f52dfbb451fc85d2e8eb
This commit is contained in:
parent
050ec69f83
commit
43c29716ee
@ -107,8 +107,8 @@ class StressNotificationsService(cotyledon.Service):
|
|||||||
{},
|
{},
|
||||||
notification_type,
|
notification_type,
|
||||||
payload)
|
payload)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot notify - %s - %s', notification_type, e)
|
LOG.exception('Cannot notify - %s', notification_type)
|
||||||
|
|
||||||
|
|
||||||
def create_port(port_num, instance_id, host_id, net_id):
|
def create_port(port_num, instance_id, host_id, net_id):
|
||||||
|
@ -56,7 +56,7 @@ class AlarmsController(RootRestController):
|
|||||||
return self._get_alarms(vitrage_id, all_tenants)
|
return self._get_alarms(vitrage_id, all_tenants)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get alarms %s', to_unicode)
|
LOG.exception('Failed to get alarms.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -73,7 +73,7 @@ class AlarmsController(RootRestController):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to open file %s ', to_unicode)
|
LOG.exception('Failed to open file.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -89,7 +89,7 @@ class AlarmsController(RootRestController):
|
|||||||
return self._show_alarm(vitrage_id)
|
return self._show_alarm(vitrage_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to load json %s ', to_unicode)
|
LOG.exception('Failed to load JSON.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -105,5 +105,5 @@ class AlarmsController(RootRestController):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to load json %s ', to_unicode)
|
LOG.exception('Failed to load JSON.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
@ -52,5 +52,5 @@ class CountsController(RootRestController):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get alarm counts %s', to_unicode)
|
LOG.exception('failed to get alarm count.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
@ -61,5 +61,5 @@ class RCAController(RootRestController):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get rca %s ', to_unicode)
|
LOG.exception('Failed to get RCA.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
@ -48,7 +48,7 @@ class ResourcesController(RootRestController):
|
|||||||
return self._get_resources(resource_type, all_tenants)
|
return self._get_resources(resource_type, all_tenants)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to list resources %s', to_unicode)
|
LOG.exception('Failed to list resources.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -66,7 +66,7 @@ class ResourcesController(RootRestController):
|
|||||||
return resources
|
return resources
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get resources %s ', to_unicode)
|
LOG.exception('Failed to get resources.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -96,6 +96,6 @@ class ResourcesController(RootRestController):
|
|||||||
return json.loads(resource)
|
return json.loads(resource)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to show resource with vitrage_id(%s),'
|
LOG.exception('failed to show resource with vitrage_id(%s).',
|
||||||
'Exception: %s', vitrage_id, to_unicode)
|
vitrage_id)
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
@ -44,7 +44,7 @@ class TemplateController(RootRestController):
|
|||||||
return self._get_templates()
|
return self._get_templates()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get template list %s', to_unicode)
|
LOG.exception('failed to get template list.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -61,9 +61,8 @@ class TemplateController(RootRestController):
|
|||||||
return self._show_template(template_uuid)
|
return self._show_template(template_uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to show template %s --> %s',
|
LOG.exception('Failed to show template %s.',
|
||||||
template_uuid,
|
template_uuid)
|
||||||
to_unicode)
|
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -78,7 +77,7 @@ class TemplateController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._delete(uuid)
|
return self._delete(uuid)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('failed to delete template %s', e)
|
LOG.exception('Failed to delete template.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -95,7 +94,7 @@ class TemplateController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._add(templates, template_type)
|
return self._add(templates, template_type)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('failed to add template %s', e)
|
LOG.exception('Failed to add template.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@pecan.expose('json')
|
@pecan.expose('json')
|
||||||
@ -115,7 +114,7 @@ class TemplateController(RootRestController):
|
|||||||
return self._validate(templates, template_type)
|
return self._validate(templates, template_type)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to validate template(s) %s', to_unicode)
|
LOG.exception('Failed to validate template(s).')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -127,7 +126,7 @@ class TemplateController(RootRestController):
|
|||||||
return [cls._db_template_to_dict(t) for t in templates]
|
return [cls._db_template_to_dict(t) for t in templates]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get template list %s ', to_unicode)
|
LOG.exception('Failed to get template list.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -139,7 +138,7 @@ class TemplateController(RootRestController):
|
|||||||
return templates[0].file_content
|
return templates[0].file_content
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to show template with uuid: %s ', to_unicode)
|
LOG.exception('Failed to show template with uuid: %s ', uuid)
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -153,7 +152,7 @@ class TemplateController(RootRestController):
|
|||||||
return json.loads(result_json)
|
return json.loads(result_json)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to open template file(s) %s ', to_unicode)
|
LOG.exception('Failed to open template file(s).')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -166,7 +165,7 @@ class TemplateController(RootRestController):
|
|||||||
template_type=template_type)
|
template_type=template_type)
|
||||||
return results
|
return results
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('failed to add template file %s ', e)
|
LOG.exception('Failed to add template file.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -189,5 +188,5 @@ class TemplateController(RootRestController):
|
|||||||
uuids=uuid)
|
uuids=uuid)
|
||||||
return results
|
return results
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('failed to delete template %s ', e)
|
LOG.exception('Failed to delete template.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
@ -91,7 +91,7 @@ class TopologyController(RootRestController):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
to_unicode = encodeutils.exception_to_unicode(e)
|
to_unicode = encodeutils.exception_to_unicode(e)
|
||||||
LOG.exception('failed to get topology %s ', to_unicode)
|
LOG.exception('failed to get topology.')
|
||||||
abort(404, to_unicode)
|
abort(404, to_unicode)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -46,7 +46,7 @@ class WebhookController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._get_all(all_tenants)
|
return self._get_all(all_tenants)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('failed to list webhooks %s', e)
|
LOG.exception('Failed to list webhooks.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -68,7 +68,7 @@ class WebhookController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._get(id)
|
return self._get(id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('Failed to get webhooks %s', e)
|
LOG.exception('Failed to get webhooks.')
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -91,7 +91,7 @@ class WebhookController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._post(**kwargs)
|
return self._post(**kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('Failed to add webhooks %s', e)
|
LOG.exception('Failed to add webhooks.')
|
||||||
abort(400, str(e))
|
abort(400, str(e))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -125,8 +125,7 @@ class WebhookController(RootRestController):
|
|||||||
try:
|
try:
|
||||||
return self._delete_registration(id)
|
return self._delete_registration(id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('Failed to delete webhook %s: '
|
LOG.exception('Failed to delete webhook "%s"', id)
|
||||||
'%s' % (id, str(e)))
|
|
||||||
abort(404, str(e))
|
abort(404, str(e))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -91,8 +91,8 @@ class AodhDriver(AlarmDriverBase):
|
|||||||
aodh_alarms = self.client.alarm.list()
|
aodh_alarms = self.client.alarm.list()
|
||||||
return [self._convert_alarm(alarm) for alarm in
|
return [self._convert_alarm(alarm) for alarm in
|
||||||
aodh_alarms if alarm is not None]
|
aodh_alarms if alarm is not None]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Failed to get all alarms, Exception: %s", e)
|
LOG.exception("Failed to get all alarms.")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def _is_erroneous(self, alarm):
|
def _is_erroneous(self, alarm):
|
||||||
@ -289,9 +289,8 @@ class AodhDriver(AlarmDriverBase):
|
|||||||
entity = old_alarm.copy()
|
entity = old_alarm.copy()
|
||||||
try:
|
try:
|
||||||
entity[AodhProps.STATE] = event[AodhProps.DETAIL][AodhProps.STATE]
|
entity[AodhProps.STATE] = event[AodhProps.DETAIL][AodhProps.STATE]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Failed to Convert alarm state"
|
LOG.exception("Failed to Convert alarm state transition event.")
|
||||||
" transition event - %s", e)
|
|
||||||
|
|
||||||
return self._filter_and_cache_alarm(entity, old_alarm,
|
return self._filter_and_cache_alarm(entity, old_alarm,
|
||||||
self._filter_get_change,
|
self._filter_get_change,
|
||||||
|
@ -61,8 +61,8 @@ class CeilometerDriver(AlarmDriverBase):
|
|||||||
aodh_alarms = self.client.alarms.list()
|
aodh_alarms = self.client.alarms.list()
|
||||||
return [self._convert_alarm(alarm) for alarm in
|
return [self._convert_alarm(alarm) for alarm in
|
||||||
aodh_alarms if alarm is not None]
|
aodh_alarms if alarm is not None]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Failed to get all alarms, Exception: %s", e)
|
LOG.exception("Failed to get all alarms.")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def _is_erroneous(self, alarm):
|
def _is_erroneous(self, alarm):
|
||||||
@ -358,9 +358,8 @@ class CeilometerDriver(AlarmDriverBase):
|
|||||||
entity = old_alarm.copy()
|
entity = old_alarm.copy()
|
||||||
try:
|
try:
|
||||||
entity[CeilProps.STATE] = event[CeilProps.DETAIL][CeilProps.STATE]
|
entity[CeilProps.STATE] = event[CeilProps.DETAIL][CeilProps.STATE]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Failed to Convert alarm state"
|
LOG.exception("Failed to Convert alarm state transition event.")
|
||||||
" transition event - %s", e)
|
|
||||||
|
|
||||||
return self._filter_and_cache_alarm(entity, old_alarm,
|
return self._filter_and_cache_alarm(entity, old_alarm,
|
||||||
self._filter_get_change,
|
self._filter_get_change,
|
||||||
|
@ -75,8 +75,8 @@ class CollectdDriver(AlarmDriverBase):
|
|||||||
LOG.debug('collectd mappings: %s', str(mappings))
|
LOG.debug('collectd mappings: %s', str(mappings))
|
||||||
|
|
||||||
return mappings
|
return mappings
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('failed in init %s ', e)
|
LOG.exception('Failed in init.')
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def enrich_event(self, event, event_type):
|
def enrich_event(self, event, event_type):
|
||||||
|
@ -53,6 +53,6 @@ class CollectorNotifier(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.oslo_notifier.info({}, '', enriched_event)
|
self.oslo_notifier.info({}, '', enriched_event)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Datasource event cannot be notified - %s\n'
|
LOG.exception('Datasource event cannot be notified - %s.',
|
||||||
'Error - %s', enriched_event, e)
|
enriched_event)
|
||||||
|
@ -51,8 +51,8 @@ class KubernetesDriver(DriverBase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
return k8s_client
|
return k8s_client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create k8s client - Got Exception: %s', e)
|
LOG.exception('Create k8s client - Got Exception')
|
||||||
|
|
||||||
def get_all(self, datasource_action):
|
def get_all(self, datasource_action):
|
||||||
return self.make_pickleable(self._prepare_entities(
|
return self.make_pickleable(self._prepare_entities(
|
||||||
|
@ -35,8 +35,8 @@ class NagiosConfig(object):
|
|||||||
nagios = nagios_config[NAGIOS] # nagios root in the yaml file
|
nagios = nagios_config[NAGIOS] # nagios root in the yaml file
|
||||||
|
|
||||||
self.mappings = [self._create_mapping(config) for config in nagios]
|
self.mappings = [self._create_mapping(config) for config in nagios]
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('failed in init %s ', e)
|
LOG.exception('Failed in init.')
|
||||||
self.mappings = []
|
self.mappings = []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -37,9 +37,8 @@ class NagiosParser(object):
|
|||||||
|
|
||||||
return self._parse_services(status_tables)
|
return self._parse_services(status_tables)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to get nagios services %s', e)
|
LOG.exception('Failed to get nagios services.')
|
||||||
return None
|
|
||||||
|
|
||||||
def _parse_services(self, status_tables):
|
def _parse_services(self, status_tables):
|
||||||
LOG.debug('Start parsing Nagios status')
|
LOG.debug('Start parsing Nagios status')
|
||||||
|
@ -79,12 +79,11 @@ class DriversEndpoint(object):
|
|||||||
fault_interval = self.conf.datasources.snapshot_interval_on_fault
|
fault_interval = self.conf.datasources.snapshot_interval_on_fault
|
||||||
|
|
||||||
def run_driver(driver):
|
def run_driver(driver):
|
||||||
ok = True
|
|
||||||
try:
|
try:
|
||||||
return ok, driver.get_all(action)
|
return True, driver.get_all(action)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('driver failed %s', e)
|
LOG.exception('Driver failed')
|
||||||
return not ok, driver
|
return False, driver
|
||||||
|
|
||||||
result = list(self.pool.map(run_driver, drivers))
|
result = list(self.pool.map(run_driver, drivers))
|
||||||
failed_drivers = [driver for success, driver in result if not success]
|
failed_drivers = [driver for success, driver in result if not success]
|
||||||
|
@ -60,8 +60,8 @@ class ZabbixDriver(AlarmDriverBase):
|
|||||||
self._client.login(
|
self._client.login(
|
||||||
self.conf.zabbix.user,
|
self.conf.zabbix.user,
|
||||||
self.conf.zabbix.password)
|
self.conf.zabbix.password)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('pyzabbix.ZabbixAPI %s', e)
|
LOG.exception('pyzabbix.ZabbixAPI error occurred.')
|
||||||
self._client = None
|
self._client = None
|
||||||
|
|
||||||
def _vitrage_type(self):
|
def _vitrage_type(self):
|
||||||
@ -168,8 +168,8 @@ class ZabbixDriver(AlarmDriverBase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return mappings
|
return mappings
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('failed in init %s ', e)
|
LOG.exception('Failed in init.')
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def enrich_event(self, event, event_type):
|
def enrich_event(self, event, event_type):
|
||||||
|
@ -60,9 +60,8 @@ class ConsistencyEnforcer(object):
|
|||||||
stale_entities)
|
stale_entities)
|
||||||
self._push_events_to_queue(stale_entities,
|
self._push_events_to_queue(stale_entities,
|
||||||
GraphAction.DELETE_ENTITY)
|
GraphAction.DELETE_ENTITY)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception(
|
LOG.exception('Error in deleting vertices from entity_graph.')
|
||||||
'Error in deleting vertices from entity_graph: %s', e)
|
|
||||||
|
|
||||||
def _find_placeholder_entities(self):
|
def _find_placeholder_entities(self):
|
||||||
vitrage_sample_tstmp = str(utcnow() - timedelta(
|
vitrage_sample_tstmp = str(utcnow() - timedelta(
|
||||||
|
@ -49,8 +49,8 @@ def get_all(rpc_client, events_coordination, driver_names, action,
|
|||||||
events = _call(client)
|
events = _call(client)
|
||||||
else:
|
else:
|
||||||
events = _call(rpc_client)
|
events = _call(rpc_client)
|
||||||
except oslo_messaging.MessagingTimeout as e:
|
except oslo_messaging.MessagingTimeout:
|
||||||
LOG.exception('Got MessagingTimeout %s', e)
|
LOG.exception('Got MessagingTimeout')
|
||||||
events = _call(rpc_client) if retry_on_fault else []
|
events = _call(rpc_client) if retry_on_fault else []
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
events_coordination.handle_multiple_low_priority(events)
|
events_coordination.handle_multiple_low_priority(events)
|
||||||
|
@ -85,8 +85,8 @@ class EventsCoordination(object):
|
|||||||
def do_work(event):
|
def do_work(event):
|
||||||
try:
|
try:
|
||||||
return do_work_func(event)
|
return do_work_func(event)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Got Exception %s for event %s', e, str(event))
|
LOG.exception('Got Exception for event %s', str(event))
|
||||||
|
|
||||||
self._do_work_func = do_work
|
self._do_work_func = do_work
|
||||||
|
|
||||||
@ -146,5 +146,5 @@ class PushNotificationsEndpoint(object):
|
|||||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||||
try:
|
try:
|
||||||
self.process_event_callback(payload)
|
self.process_event_callback(payload)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception(e)
|
LOG.exception('Failed to process event callback.')
|
||||||
|
@ -124,11 +124,10 @@ class DatasourceInfoMapper(object):
|
|||||||
self.OPERATIONAL_VALUES: operational_values,
|
self.OPERATIONAL_VALUES: operational_values,
|
||||||
self.PRIORITY_VALUES: priority_values
|
self.PRIORITY_VALUES: priority_values
|
||||||
}
|
}
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Exception: %s", e)
|
|
||||||
datasource = os.path.splitext(file_name)[0]
|
datasource = os.path.splitext(file_name)[0]
|
||||||
LOG.error('erroneous data sources is %s',
|
erroneous_datasources_conf.append(datasource)
|
||||||
erroneous_datasources_conf.append(datasource))
|
LOG.exception('Erroneous data source is %s', datasource)
|
||||||
|
|
||||||
self._check_value_confs_exists(
|
self._check_value_confs_exists(
|
||||||
[key for key in valid_datasources_conf.keys()],
|
[key for key in valid_datasources_conf.keys()],
|
||||||
|
@ -97,8 +97,8 @@ class GraphNotifier(object):
|
|||||||
{},
|
{},
|
||||||
notification_type,
|
notification_type,
|
||||||
curr.properties)
|
curr.properties)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot notify - %s - %s', notification_type, e)
|
LOG.exception('Cannot notify - %s.', notification_type)
|
||||||
|
|
||||||
|
|
||||||
def _get_notification_type(before, current, is_vertex):
|
def _get_notification_type(before, current, is_vertex):
|
||||||
|
@ -317,8 +317,8 @@ class Processor(processor.ProcessorBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
self.info_mapper.vitrage_aggregate_values(vertex, graph_vertex)
|
self.info_mapper.vitrage_aggregate_values(vertex, graph_vertex)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Calculate aggregated state failed - %s", e)
|
LOG.exception("Calculate aggregated state failed.")
|
||||||
|
|
||||||
def _enrich_event(self, event):
|
def _enrich_event(self, event):
|
||||||
attr = self.transformer_manager.get_enrich_query(event)
|
attr = self.transformer_manager.get_enrich_query(event)
|
||||||
|
@ -50,9 +50,9 @@ class TransformerManager(object):
|
|||||||
conf[datasource_type].transformer,
|
conf[datasource_type].transformer,
|
||||||
transformers, conf)
|
transformers, conf)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to register transformer %s. '
|
LOG.exception('Failed to register transformer %s.',
|
||||||
'Exception: %s', datasource_type, e)
|
datasource_type)
|
||||||
|
|
||||||
transformers[VITRAGE_DATASOURCE] = importutils.import_object(
|
transformers[VITRAGE_DATASOURCE] = importutils.import_object(
|
||||||
"%s.%s" % (EvaluatorEventTransformer.__module__,
|
"%s.%s" % (EvaluatorEventTransformer.__module__,
|
||||||
|
@ -59,8 +59,8 @@ class Scheduler(object):
|
|||||||
if self.graph_persistor:
|
if self.graph_persistor:
|
||||||
try:
|
try:
|
||||||
self.graph_persistor.store_graph(graph=self.graph)
|
self.graph_persistor.store_graph(graph=self.graph)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('persist failed %s', e)
|
LOG.exception('Persist failed.')
|
||||||
|
|
||||||
self.periodic.add(persist_periodic)
|
self.periodic.add(persist_periodic)
|
||||||
LOG.info("added persist_periodic (spacing=%s)", spacing)
|
LOG.info("added persist_periodic (spacing=%s)", spacing)
|
||||||
@ -72,8 +72,8 @@ class Scheduler(object):
|
|||||||
def consistency_periodic():
|
def consistency_periodic():
|
||||||
try:
|
try:
|
||||||
self.consistency.periodic_process()
|
self.consistency.periodic_process()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('run_consistency failed %s', e)
|
LOG.exception('run_consistency failed.')
|
||||||
|
|
||||||
self.periodic.add(consistency_periodic)
|
self.periodic.add(consistency_periodic)
|
||||||
LOG.info("added consistency_periodic (spacing=%s)", spacing)
|
LOG.info("added consistency_periodic (spacing=%s)", spacing)
|
||||||
@ -89,8 +89,8 @@ class Scheduler(object):
|
|||||||
self.events_coordination,
|
self.events_coordination,
|
||||||
self.conf.datasources.types,
|
self.conf.datasources.types,
|
||||||
DatasourceAction.SNAPSHOT)
|
DatasourceAction.SNAPSHOT)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('get_all_periodic failed %s', e)
|
LOG.exception('get_all_periodic failed.')
|
||||||
|
|
||||||
self.periodic.add(get_all_periodic)
|
self.periodic.add(get_all_periodic)
|
||||||
LOG.info("added get_all_periodic (spacing=%s)", spacing)
|
LOG.info("added get_all_periodic (spacing=%s)", spacing)
|
||||||
@ -106,9 +106,9 @@ class Scheduler(object):
|
|||||||
ds_rpc.get_changes(rpc_client,
|
ds_rpc.get_changes(rpc_client,
|
||||||
self.events_coordination,
|
self.events_coordination,
|
||||||
driver_name)
|
driver_name)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('get_changes_periodic %s failed %s',
|
LOG.exception('get_changes_periodic "%s" failed.',
|
||||||
driver_name, e)
|
driver_name)
|
||||||
|
|
||||||
self.periodic.add(get_changes_periodic)
|
self.periodic.add(get_changes_periodic)
|
||||||
LOG.info("added get_changes_periodic %s (spacing=%s)",
|
LOG.info("added get_changes_periodic %s (spacing=%s)",
|
||||||
|
@ -232,8 +232,8 @@ class GraphCloneWorkerBase(cotyledon.Service):
|
|||||||
try:
|
try:
|
||||||
next_task = self._task_queue.get()
|
next_task = self._task_queue.get()
|
||||||
self.do_task(next_task)
|
self.do_task(next_task)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Graph may not be in sync: exception %s", e)
|
LOG.exception("Graph may not be in sync.")
|
||||||
self._task_queue.task_done()
|
self._task_queue.task_done()
|
||||||
|
|
||||||
def do_task(self, task):
|
def do_task(self, task):
|
||||||
|
@ -72,7 +72,6 @@ class EvaluatorNotifier(object):
|
|||||||
{},
|
{},
|
||||||
NotifierEventTypes.EXECUTE_EXTERNAL_ACTION,
|
NotifierEventTypes.EXECUTE_EXTERNAL_ACTION,
|
||||||
properties)
|
properties)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot notify - %s - %s',
|
LOG.exception('Cannot notify - %s.',
|
||||||
NotifierEventTypes.EXECUTE_EXTERNAL_ACTION,
|
NotifierEventTypes.EXECUTE_EXTERNAL_ACTION)
|
||||||
e)
|
|
||||||
|
@ -133,10 +133,9 @@ class ScenarioEvaluator(object):
|
|||||||
actions_to_preform = []
|
actions_to_preform = []
|
||||||
try:
|
try:
|
||||||
actions_to_preform = self._analyze_and_filter_actions(actions)
|
actions_to_preform = self._analyze_and_filter_actions(actions)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.error("Evaluator error, will not execute actions %s",
|
LOG.exception("Evaluator error, will not execute actions %s",
|
||||||
str(actions))
|
str(actions))
|
||||||
LOG.exception("Caught: %s", e)
|
|
||||||
|
|
||||||
for action in actions_to_preform:
|
for action in actions_to_preform:
|
||||||
LOG.info('Action: %s', self._action_str(action))
|
LOG.info('Action: %s', self._action_str(action))
|
||||||
|
@ -49,11 +49,11 @@ def save_accumulated_data(data_manager):
|
|||||||
try:
|
try:
|
||||||
with open(ACTIVITY_PATH, 'wb') as activity_f:
|
with open(ACTIVITY_PATH, 'wb') as activity_f:
|
||||||
pickle.dump(activity, activity_f)
|
pickle.dump(activity, activity_f)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot save alarms_intersect - %s', e)
|
LOG.exception('Cannot save alarms_intersect.')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(INTERSECT_PATH, 'wb') as intersect_f:
|
with open(INTERSECT_PATH, 'wb') as intersect_f:
|
||||||
pickle.dump(intersects, intersect_f)
|
pickle.dump(intersects, intersect_f)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot save alarms_intersect - %s', e)
|
LOG.exception('Cannot save alarms_intersect.')
|
||||||
|
@ -105,8 +105,8 @@ class CorrelationManager(object):
|
|||||||
alarm[0][0] + " <-> alarm " +
|
alarm[0][0] + " <-> alarm " +
|
||||||
alarm[0][3] + " on " + alarm[0][2] +
|
alarm[0][3] + " on " + alarm[0][2] +
|
||||||
" with score " + str(alarm[1]) + "\n")
|
" with score " + str(alarm[1]) + "\n")
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Cannot save correlations - %s', e)
|
LOG.exception('Cannot save correlations.')
|
||||||
|
|
||||||
if os.path.isfile(self.last_written_file):
|
if os.path.isfile(self.last_written_file):
|
||||||
os.remove(self.last_written_file)
|
os.remove(self.last_written_file)
|
||||||
|
@ -78,7 +78,7 @@ class VitrageNotifier(object):
|
|||||||
if self.notifier:
|
if self.notifier:
|
||||||
try:
|
try:
|
||||||
self.notifier.info({}, event_type, data)
|
self.notifier.info({}, event_type, data)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Notifier cannot notify - %e', e)
|
LOG.exception('Notifier cannot notify.')
|
||||||
else:
|
else:
|
||||||
LOG.error('Notifier cannot notify')
|
LOG.error('Notifier cannot notify')
|
||||||
|
@ -63,9 +63,8 @@ class AodhNotifier(NotifierBase):
|
|||||||
try:
|
try:
|
||||||
LOG.info('Aodh Alarm - Activate: ' + str(alarm_request))
|
LOG.info('Aodh Alarm - Activate: ' + str(alarm_request))
|
||||||
return self.client.alarm.create(alarm_request)
|
return self.client.alarm.create(alarm_request)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to activate Aodh Alarm Got Exception: %s', e)
|
LOG.exception('Failed to activate Aodh Alarm. Got Exception.')
|
||||||
return
|
|
||||||
|
|
||||||
def _update_aodh_alarm(self, alarm, state):
|
def _update_aodh_alarm(self, alarm, state):
|
||||||
aodh_id = alarm.get(VProps.ID)
|
aodh_id = alarm.get(VProps.ID)
|
||||||
@ -74,9 +73,8 @@ class AodhNotifier(NotifierBase):
|
|||||||
alarm_update = {AodhState: state}
|
alarm_update = {AodhState: state}
|
||||||
return self.client.alarm.update(alarm_id=aodh_id,
|
return self.client.alarm.update(alarm_id=aodh_id,
|
||||||
alarm_update=alarm_update)
|
alarm_update=alarm_update)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to update Aodh Alarm Got Exception: %s', e)
|
LOG.exception('Failed to update Aodh Alarm. Got Exception.')
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def _alarm_request(data, state):
|
def _alarm_request(data, state):
|
||||||
|
@ -61,8 +61,8 @@ class NovaNotifier(NotifierBase):
|
|||||||
response = self.client.services.force_down(
|
response = self.client.services.force_down(
|
||||||
host_id, 'nova-compute', is_down)
|
host_id, 'nova-compute', is_down)
|
||||||
LOG.info('RESPONSE %s', str(response.to_dict()))
|
LOG.info('RESPONSE %s', str(response.to_dict()))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to services.force_down - %s', e)
|
LOG.exception('Failed to services.force_down.')
|
||||||
|
|
||||||
def _reset_instance_state(self, server_id, is_down):
|
def _reset_instance_state(self, server_id, is_down):
|
||||||
state = InstanceState.ERROR if is_down else InstanceState.ACTIVE
|
state = InstanceState.ERROR if is_down else InstanceState.ACTIVE
|
||||||
@ -71,5 +71,5 @@ class NovaNotifier(NotifierBase):
|
|||||||
str(server_id), str(state))
|
str(server_id), str(state))
|
||||||
response = self.client.servers.reset_state(server_id, state)
|
response = self.client.servers.reset_state(server_id, state)
|
||||||
LOG.info('RESPONSE %s', str(response))
|
LOG.info('RESPONSE %s', str(response))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Failed to execute servers.reset_state - %s', e)
|
LOG.exception('Failed to execute servers.reset_state.')
|
||||||
|
@ -42,10 +42,8 @@ class SnmpNotifier(NotifierBase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.snmp_sender.send_snmp(self._parse_alarm_data(data))
|
self.snmp_sender.send_snmp(self._parse_alarm_data(data))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Vitrage snmp Error: '
|
LOG.exception('Vitrage SNMP Error: Failed to send SNMP trap.')
|
||||||
'Failed to send SNMP trap: %s', e)
|
|
||||||
return
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse_alarm_data(data):
|
def _parse_alarm_data(data):
|
||||||
|
@ -113,9 +113,8 @@ class Webhook(NotifierBase):
|
|||||||
LOG.info('posted %s to %s. Response status %s, reason %s',
|
LOG.info('posted %s to %s. Response status %s, reason %s',
|
||||||
str(webhook_data), str(webhook[URL]),
|
str(webhook_data), str(webhook[URL]),
|
||||||
resp.status_code, resp.reason)
|
resp.status_code, resp.reason)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception("Could not post to webhook %s %s" % (
|
LOG.exception("Could not post to webhook '%s'", str(webhook['id']))
|
||||||
str(webhook['id']), str(e)))
|
|
||||||
|
|
||||||
def _load_webhooks(self):
|
def _load_webhooks(self):
|
||||||
db_webhooks = self._db.webhooks.query()
|
db_webhooks = self._db.webhooks.query()
|
||||||
|
@ -57,8 +57,8 @@ def aodh_client(conf):
|
|||||||
session=keystone_client.get_session(conf))
|
session=keystone_client.get_session(conf))
|
||||||
LOG.info('Aodh client created')
|
LOG.info('Aodh client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Aodh client - Got Exception: %s', e)
|
LOG.exception('Create Aodh client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def ceilometer_client(conf):
|
def ceilometer_client(conf):
|
||||||
@ -71,8 +71,8 @@ def ceilometer_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Ceilometer client created')
|
LOG.info('Ceilometer client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Ceilometer client - Got Exception: %s', e)
|
LOG.exception('Create Ceilometer client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def nova_client(conf):
|
def nova_client(conf):
|
||||||
@ -85,8 +85,8 @@ def nova_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Nova client created')
|
LOG.info('Nova client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Nova client - Got Exception: %s', e)
|
LOG.exception('Create Nova client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def cinder_client(conf):
|
def cinder_client(conf):
|
||||||
@ -99,8 +99,8 @@ def cinder_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Cinder client created')
|
LOG.info('Cinder client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Cinder client - Got Exception: %s', e)
|
LOG.exception('Create Cinder client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def glance_client(conf):
|
def glance_client(conf):
|
||||||
@ -113,8 +113,8 @@ def glance_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Glance client created')
|
LOG.info('Glance client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Glance client - Got Exception: %s', e)
|
LOG.exception('Create Glance client - Got Exception')
|
||||||
|
|
||||||
|
|
||||||
def neutron_client(conf):
|
def neutron_client(conf):
|
||||||
@ -126,8 +126,8 @@ def neutron_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Neutron client created')
|
LOG.info('Neutron client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Neutron client - Got Exception: %s', e)
|
LOG.exception('Create Neutron client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def heat_client(conf):
|
def heat_client(conf):
|
||||||
@ -140,8 +140,8 @@ def heat_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Heat client created')
|
LOG.info('Heat client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Heat client - Got Exception: %s', e)
|
LOG.exception('Create Heat client - Got Exception.')
|
||||||
|
|
||||||
|
|
||||||
def mistral_client(conf):
|
def mistral_client(conf):
|
||||||
@ -153,5 +153,5 @@ def mistral_client(conf):
|
|||||||
)
|
)
|
||||||
LOG.info('Mistral client created')
|
LOG.info('Mistral client created')
|
||||||
return client
|
return client
|
||||||
except Exception as e:
|
except Exception:
|
||||||
LOG.exception('Create Mistral client - Got Exception: %s', e)
|
LOG.exception('Create Mistral client - Got Exception.')
|
||||||
|
Loading…
Reference in New Issue
Block a user