← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~chad.smith/cloud-init:fix-include-url-error-message-centos into cloud-init:master

 

Chad Smith has proposed merging ~chad.smith/cloud-init:fix-include-url-error-message-centos into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/333845

centos: Provide the failed #include url in error messages

On python 2.6 and 2.7 (CentOS 6 & 7), UrlErrors raised do not report which url 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/job/cloud-init-ci-nightly/.
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:fix-include-url-error-message-centos into cloud-init:master.
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index e163c72..9e13793 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -236,7 +236,10 @@ class UserDataProcessor(object):
                                      " a invalid http code of %s"),
                                     include_url, resp.code)
                 except UrlError as urle:
-                    LOG.warning(urle)
+                    message = str(urle)
+                    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)

Follow ups