summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-08-07 00:45:11 -0500
committerScott Moser <smoser@ubuntu.com>2015-08-07 00:45:11 -0500
commit89b381f01c727c8fb00724eb28bf98eafd97dbb4 (patch)
treedd3365f5658510e0ee5cb5c9992708f6036802c7
parent48cb8699efb5c6116dfa7b4d76d0a5fb6b3fbbbf (diff)
downloadvyos-cloud-init-89b381f01c727c8fb00724eb28bf98eafd97dbb4.tar.gz
vyos-cloud-init-89b381f01c727c8fb00724eb28bf98eafd97dbb4.zip
seems functional in test
-rw-r--r--cloudinit/reporting/handlers.py2
-rw-r--r--cloudinit/url_helper.py10
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