summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-11-16 20:47:02 -0700
committerChad Smith <chad.smith@canonical.com>2017-11-16 20:47:02 -0700
commit6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb (patch)
treef21b2f9028b59a20239f0eddd251e138e48479ec
parente10ad2d7854b87024b5d051db50166125fce2279 (diff)
downloadcloud-init-git-6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb.tar.gz
centos: Provide the failed #include url in error messages
On python 2.7 and earlier (CentOS 6 & 7), UrlErrors raised by requests do not report the url which failed. In such cases, append the url if not present in the error message. This fixes nightly CI failures at https://jenkins.ubuntu.com/server/view/cloud-init/.
-rw-r--r--cloudinit/user_data.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index e163c722..cc55daf8 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -236,7 +236,12 @@ class UserDataProcessor(object):
" a invalid http code of %s"),
include_url, resp.code)
except UrlError as urle:
- LOG.warning(urle)
+ message = str(urle)
+ # Older versions of requests.exceptions.HTTPError may not
+ # include the errant url. Append it for clarity in logs.
+ if include_url not in message:
+ message += ' for url: {0}'.format(include_url)
+ LOG.warning(message)
except IOError as ioe:
LOG.warning("Fetching from %s resulted in %s",
include_url, ioe)