Merge lp:~corey.bryant/charm-helpers/install-warning into lp:charm-helpers

Proposed by Corey Bryant
Status: Merged
Merged at revision: 403
Proposed branch: lp:~corey.bryant/charm-helpers/install-warning
Merge into: lp:charm-helpers
Diff against target: 28 lines (+4/-3)
2 files modified
charmhelpers/fetch/__init__.py (+3/-2)
charmhelpers/fetch/giturl.py (+1/-1)
To merge this branch: bzr merge lp:~corey.bryant/charm-helpers/install-warning
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+264340@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

If an install_remote() handler fails, it should provide a clear error. For example, currently if git clone fails, the install_remote() code masks the original exception that was raised by the git handler, and raises UnhandledSource, making it difficult to understand what the cause of the original failure is.

This fix logs the original exception details as a warning before the UnhandledSource traceback.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/fetch/__init__.py'
2--- charmhelpers/fetch/__init__.py 2015-07-02 10:21:01 +0000
3+++ charmhelpers/fetch/__init__.py 2015-07-09 19:56:43 +0000
4@@ -378,8 +378,9 @@
5 for handler in handlers:
6 try:
7 installed_to = handler.install(source, *args, **kwargs)
8- except UnhandledSource:
9- pass
10+ except UnhandledSource as e:
11+ log('Install source attempt unsuccessful: {}'.format(e),
12+ level='WARNING')
13 if not installed_to:
14 raise UnhandledSource("No handler found for source {}".format(source))
15 return installed_to
16
17=== modified file 'charmhelpers/fetch/giturl.py'
18--- charmhelpers/fetch/giturl.py 2015-05-27 12:55:44 +0000
19+++ charmhelpers/fetch/giturl.py 2015-07-09 19:56:43 +0000
20@@ -67,7 +67,7 @@
21 try:
22 self.clone(source, dest_dir, branch, depth)
23 except GitCommandError as e:
24- raise UnhandledSource(e.message)
25+ raise UnhandledSource(e)
26 except OSError as e:
27 raise UnhandledSource(e.strerror)
28 return dest_dir

Subscribers

People subscribed via source and target branches