diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-10-01 11:50:48 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-10-01 11:50:48 -0400 |
commit | f8b23b39bdf8753986df9ecf5948ffd8e8fdee74 (patch) | |
tree | 2be0d98d9bba220b5e52564f393539009f5e1f4c /cloudinit/sources/DataSourceMAAS.py | |
parent | 497972223afd5193a40e3e9c4e69ce31319a1ebc (diff) | |
download | vyos-cloud-init-f8b23b39bdf8753986df9ecf5948ffd8e8fdee74.tar.gz vyos-cloud-init-f8b23b39bdf8753986df9ecf5948ffd8e8fdee74.zip |
fix oauth time skew. actual implementation was returning 401 not 403.
This fixes (tested) bug 978127. The server was actually returning a 401
not a 403. As such, the fix here was insufficient. This will now take
either of those 2 error codes. I've also tested it by changing the clock
in the cloud-init upstart job with a stanza like below, and verifying
that we do see the problem and then it resolve itself:
pre-start script
offset="10 minutes ago"
past=$(date -R --date "$offset")
date --set "$past" &&
echo ===== "set date to $past [$offset]" ===== ||
echo ===== "failed to set date to $past [$offset]" ====
end script
LP: #978127
Diffstat (limited to 'cloudinit/sources/DataSourceMAAS.py')
-rw-r--r-- | cloudinit/sources/DataSourceMAAS.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceMAAS.py b/cloudinit/sources/DataSourceMAAS.py index ec52d775..e187aec9 100644 --- a/cloudinit/sources/DataSourceMAAS.py +++ b/cloudinit/sources/DataSourceMAAS.py @@ -145,10 +145,10 @@ class DataSourceMAAS(sources.DataSource): def _except_cb(self, msg, exception): if not (isinstance(exception, urllib2.HTTPError) and - exception.code == 403): + (exception.code == 403 or exception.code == 401)): return if 'date' not in exception.headers: - LOG.warn("date field not in 403 headers") + LOG.warn("date field not in %d headers" % exception.code) return date = exception.headers['date'] |