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