diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-08-07 00:45:11 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-08-07 00:45:11 -0500 |
commit | 89b381f01c727c8fb00724eb28bf98eafd97dbb4 (patch) | |
tree | dd3365f5658510e0ee5cb5c9992708f6036802c7 | |
parent | 48cb8699efb5c6116dfa7b4d76d0a5fb6b3fbbbf (diff) | |
download | vyos-cloud-init-89b381f01c727c8fb00724eb28bf98eafd97dbb4.tar.gz vyos-cloud-init-89b381f01c727c8fb00724eb28bf98eafd97dbb4.zip |
seems functional in test
-rw-r--r-- | cloudinit/reporting/handlers.py | 2 | ||||
-rw-r--r-- | cloudinit/url_helper.py | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/cloudinit/reporting/handlers.py b/cloudinit/reporting/handlers.py index a962edae..eecd0a96 100644 --- a/cloudinit/reporting/handlers.py +++ b/cloudinit/reporting/handlers.py @@ -46,7 +46,7 @@ class WebHookHandler(ReportingHandler): super(WebHookHandler, self).__init__() if any([consumer_key, token_key, token_secret, consumer_secret]): - self.oauth_helper = url_helper.OauthHelper( + self.oauth_helper = url_helper.OauthUrlHelper( consumer_key=consumer_key, token_key=token_key, token_secret=token_secret, consumer_secret=consumer_secret) else: diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index 2141cdc5..e598661f 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -385,7 +385,6 @@ class OauthUrlHelper(object): self.token_key = token_key self.token_secret = token_secret self.skew_data_file = skew_data_file - self.skew_data = {} self._do_oauth = True self.skew_change_limit = 5 required = (self.token_key, self.token_secret, self.consumer_key) @@ -445,7 +444,7 @@ class OauthUrlHelper(object): timestamp = None host = urlparse(url).netloc - if host in self.skew_data: + if self.skew_data and host in self.skew_data: timestamp = int(time.time()) + self.skew_data[host] return oauth_headers( @@ -466,21 +465,20 @@ class OauthUrlHelper(object): def readurl(self, *args, **kwargs): return self._wrapped(readurl, args, kwargs) - def _exception_cb(self, extra_exception_cb, url, msg, exception): + def _exception_cb(self, extra_exception_cb, msg, exception): ret = None try: if extra_exception_cb: ret = extra_exception_cb(msg, exception) finally: - self.exception_cb(self, msg, exception) + self.exception_cb(msg, exception) return ret def _headers_cb(self, extra_headers_cb, url): headers = {} if extra_headers_cb: headers = extra_headers_cb(url) - if headers: - headers.update(self.headers_cb(url)) + headers.update(self.headers_cb(url)) return headers |