summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-08-27 12:56:50 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-08-27 12:56:50 -0700
commit984d36fb8c5feb82c31121ffd5d6a72b4f593499 (patch)
tree709233ebd27e8aebe44304ec8c8d30d1afa13d4e /cloudinit
parentd701035265c765bc42cb3bc358f2bfd0b41f484b (diff)
downloadvyos-cloud-init-984d36fb8c5feb82c31121ffd5d6a72b4f593499.tar.gz
vyos-cloud-init-984d36fb8c5feb82c31121ffd5d6a72b4f593499.zip
Fix retry cb to reflect what used to exist
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/sources/helpers/openstack.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index 2d0fc70e..025a2404 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -21,7 +21,6 @@
import abc
import base64
import copy
-import httplib
import os
from cloudinit import ec2_utils
@@ -442,16 +441,21 @@ class MetadataReader(BaseReader):
def _path_read(self, path):
- def should_retry(_request_args, cause):
- if cause.code == httplib.NOT_FOUND:
- return False
+ def should_retry_cb(_request_args, cause):
+ try:
+ code = int(cause.code)
+ if code >= 400:
+ return False
+ except (TypeError, ValueError):
+ # Older versions of requests didn't have a code.
+ pass
return True
response = url_helper.readurl(path,
retries=self.retries,
ssl_details=self.ssl_details,
timeout=self.timeout,
- exception_cb=should_retry)
+ exception_cb=should_retry_cb)
return response.contents
def _path_join(self, base, *add_ons):