diff options
author | Joshua Harlow <harlowja@gmail.com> | 2014-02-08 17:29:52 -0800 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2014-02-08 17:29:52 -0800 |
commit | 5788cd903f6e4a9bab2ad32e9c1d2eb13b485ac3 (patch) | |
tree | dee32865247fe482ee9c8af0a42b6c574247555a /cloudinit/sources/helpers | |
parent | 1597aca9b0606d02c045549afce4395370502231 (diff) | |
download | vyos-cloud-init-5788cd903f6e4a9bab2ad32e9c1d2eb13b485ac3.tar.gz vyos-cloud-init-5788cd903f6e4a9bab2ad32e9c1d2eb13b485ac3.zip |
Handle code not existing in older requests versions
Diffstat (limited to 'cloudinit/sources/helpers')
-rw-r--r-- | cloudinit/sources/helpers/openstack.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py index 09fb4ad8..a17148d3 100644 --- a/cloudinit/sources/helpers/openstack.py +++ b/cloudinit/sources/helpers/openstack.py @@ -408,8 +408,13 @@ class MetadataReader(BaseReader): def _path_exists(self, path): def should_retry_cb(request, cause): - if cause.code >= 400: - return False + 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 try: |