From 8aa6bb61ddaad1977c42e0c299e4d3eeece28b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 13 Sep 2017 16:02:48 +0200 Subject: [PATCH] Slightly nicer initialisation of Bugsnag --- pillar/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pillar/__init__.py b/pillar/__init__.py index 8e75d131..3cdc3eef 100644 --- a/pillar/__init__.py +++ b/pillar/__init__.py @@ -176,7 +176,8 @@ class PillarServer(Eve): def _config_bugsnag(self): # Configure Bugsnag - if self.config.get('TESTING') or not self.config.get('BUGSNAG_API_KEY'): + bugsnag_api_key = self.config.get('BUGSNAG_API_KEY') + if self.config.get('TESTING') or not bugsnag_api_key: self.log.info('Bugsnag NOT configured.') return @@ -185,7 +186,7 @@ class PillarServer(Eve): from bugsnag.handlers import BugsnagHandler bugsnag.configure( - api_key=self.config['BUGSNAG_API_KEY'], + api_key=bugsnag_api_key, project_root="/data/git/pillar/pillar", ) handle_exceptions(self) @@ -194,6 +195,8 @@ class PillarServer(Eve): bs_handler.setLevel(logging.ERROR) self.log.addHandler(bs_handler) + self.log.info('Bugsnag setup complete') + def _config_google_cloud_storage(self): # Google Cloud project try: