diff options
author | Chad Smith <chad.smith@canonical.com> | 2017-11-16 20:47:02 -0700 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-11-16 20:47:02 -0700 |
commit | 6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb (patch) | |
tree | f21b2f9028b59a20239f0eddd251e138e48479ec /cloudinit | |
parent | e10ad2d7854b87024b5d051db50166125fce2279 (diff) | |
download | vyos-cloud-init-6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb.tar.gz vyos-cloud-init-6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb.zip |
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/.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/user_data.py | 7 |
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) |