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

Proposed by Chad Smith
Status: Merged
Approved by: Chad Smith
Approved revision: 5c5b79bb0062f275e523706b8ab247487e9001d6
Merged at revision: 6ad23fe9b11f07e4404c8a1f2f1e9cba2640dceb
Proposed branch: ~chad.smith/cloud-init:fix-include-url-error-message-centos
Merge into: cloud-init:master
Diff against target: 18 lines (+6/-1)
1 file modified
cloudinit/user_data.py (+6/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Approve
Joshua Powers (community) Approve
Review via email: mp+333845@code.launchpad.net

Commit message

centos: Provide the failed #include url in error messages

On python 2.6 and 2.7 (CentOS 6 & 7), UrlErrors raised by requests.exceptions.HTTPError 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/job/cloud-init-ci-nightly/.

Description of the change

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/.

To post a comment you must log in.
Revision history for this message
Joshua Powers (powersj) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:4198475ff145abc357b3acf424958ed2a01bdaad
https://jenkins.ubuntu.com/server/job/cloud-init-ci/505/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/505/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

one thing to note is that we run 2.7 in 'tox', so its not stricktly 2.7.
something else is different than just the python major.minor

ie, this does not fail in 'tox -e py27'

Revision history for this message
Scott Moser (smoser) wrote :

just add a comment on this branch in the exception handling as it might look odd.
clean up the commit message and i approve.

review: Approve
5c5b79b... by Chad Smith

add comment explaining that we append the url in error on older versions on requests

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:5c5b79bb0062f275e523706b8ab247487e9001d6
https://jenkins.ubuntu.com/server/job/cloud-init-ci/508/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/508/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
2index e163c72..cc55daf 100644
3--- a/cloudinit/user_data.py
4+++ b/cloudinit/user_data.py
5@@ -236,7 +236,12 @@ class UserDataProcessor(object):
6 " a invalid http code of %s"),
7 include_url, resp.code)
8 except UrlError as urle:
9- LOG.warning(urle)
10+ message = str(urle)
11+ # Older versions of requests.exceptions.HTTPError may not
12+ # include the errant url. Append it for clarity in logs.
13+ if include_url not in message:
14+ message += ' for url: {0}'.format(include_url)
15+ LOG.warning(message)
16 except IOError as ioe:
17 LOG.warning("Fetching from %s resulted in %s",
18 include_url, ioe)

Subscribers

People subscribed via source and target branches