summaryrefslogtreecommitdiff
path: root/cloudinit/reporting
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-08-07 10:15:10 -0500
committerScott Moser <smoser@ubuntu.com>2015-08-07 10:15:10 -0500
commit53f35028af55b06c19f409d6081aa766607f22a8 (patch)
treee2bc868f205efba99dca67993c8729da4948d22d /cloudinit/reporting
parentbe2d965bcd2ebd58d41b790d6cc553d98a8234c4 (diff)
downloadvyos-cloud-init-53f35028af55b06c19f409d6081aa766607f22a8.tar.gz
vyos-cloud-init-53f35028af55b06c19f409d6081aa766607f22a8.zip
catch exception in webhook, adjust logging to use cloud-init logging
Diffstat (limited to 'cloudinit/reporting')
-rw-r--r--cloudinit/reporting/handlers.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/cloudinit/reporting/handlers.py b/cloudinit/reporting/handlers.py
index eecd0a96..9cf8bd2b 100644
--- a/cloudinit/reporting/handlers.py
+++ b/cloudinit/reporting/handlers.py
@@ -1,13 +1,15 @@
# vi: ts=4 expandtab
import abc
-import logging
import oauthlib.oauth1 as oauth1
-
import six
from ..registry import DictRegistry
from .. import (url_helper, util)
+from .. import log as logging
+
+
+LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
@@ -61,10 +63,13 @@ class WebHookHandler(ReportingHandler):
readurl = self.oauth_helper.readurl
else:
readurl = url_helper.readurl
- return readurl(
- self.endpoint, data=event.as_dict(),
- timeout=self.timeout,
- retries=self.retries, ssl_details=self.ssl_details)
+ try:
+ return readurl(
+ self.endpoint, data=event.as_dict(),
+ timeout=self.timeout,
+ retries=self.retries, ssl_details=self.ssl_details)
+ except:
+ LOG.warn("failed posting event: %s" % event.as_string())
available_handlers = DictRegistry()