From 6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Thu, 16 Nov 2017 20:47:02 -0700 Subject: 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/. --- cloudinit/user_data.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cloudinit/user_data.py') 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) -- cgit v1.2.3