Merge lp:~deeptik/linaro-fetch-image/catch-lit-exception into lp:linaro-fetch-image

Proposed by Deepti B. Kalakeri
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 25
Merged at revision: 24
Proposed branch: lp:~deeptik/linaro-fetch-image/catch-lit-exception
Merge into: lp:linaro-fetch-image
Diff against target: 101 lines (+36/-27)
2 files modified
linaro-fetch-image (+33/-27)
linaro_fetch_image/fetch_image.py (+3/-0)
To merge this branch: bzr merge lp:~deeptik/linaro-fetch-image/catch-lit-exception
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Review via email: mp+129820@code.launchpad.net

Description of the change

 Adding changes in order to catch lit error message, required for ci* jobs

To post a comment you must log in.
25. By Deepti B. Kalakeri

Improving the subprocess.CalledProcessError exception

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good.

review: Approve
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

I will merge - the only issue was some lines were >80 chars long. Have fixed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro-fetch-image'
2--- linaro-fetch-image 2012-10-12 11:47:14 +0000
3+++ linaro-fetch-image 2012-10-16 10:45:25 +0000
4@@ -25,6 +25,7 @@
5 import linaro_fetch_image.fetch_image as fetch_image
6 import logging
7 import pprint
8+import subprocess
9
10
11 def main():
12@@ -66,43 +67,48 @@
13
14 # Using the config we have, look up URLs to download data from in the
15 # server index
16+ try:
17+ if config.args['platform'] == 'all':
18+ # Get release builds for specific image type, for example nano
19+ release_list = config.get_release_list(db, config.settings)
20+ platform_list = config.get_release_list_specific_to_image(release_list,
21+ config.args)
22+ for platform in platform_list:
23+ config.args['platform'] = platform
24+ image_url, hwpack_url = db.get_image_and_hwpack_urls(config.args)
25+ if(image_url and hwpack_url):
26+ if config.args['exit']:
27+ exit(0)
28+ tools_dir = os.path.dirname(__file__)
29+ if tools_dir == '':
30+ tools_dir = None
31+ file_handler.create_media(image_url, hwpack_url,
32+ config.args, tools_dir)
33+ else:
34+ logging.error("Unable to find files that match the '%s' "
35+ "release", platform)
36
37- if config.args['platform'] == 'all':
38- # Get release builds for specific image type, for example nano
39- release_list = config.get_release_list(db, config.settings)
40- platform_list = config.get_release_list_specific_to_image(release_list,
41- config.args)
42- for platform in platform_list:
43- config.args['platform'] = platform
44+ else:
45 image_url, hwpack_url = db.get_image_and_hwpack_urls(config.args)
46- if(image_url and hwpack_url):
47+
48+ if(image_url and (hwpack_url or config.args['image'] == "android")):
49 if config.args['exit']:
50 exit(0)
51 tools_dir = os.path.dirname(__file__)
52 if tools_dir == '':
53 tools_dir = None
54+
55 file_handler.create_media(image_url, hwpack_url,
56 config.args, tools_dir)
57+
58 else:
59- logging.error("Unable to find files that match the '%s' "
60- "release", platform)
61-
62- else:
63- image_url, hwpack_url = db.get_image_and_hwpack_urls(config.args)
64-
65- if(image_url and (hwpack_url or config.args['image'] == "android")):
66- if config.args['exit']:
67- exit(0)
68- tools_dir = os.path.dirname(__file__)
69- if tools_dir == '':
70- tools_dir = None
71-
72- file_handler.create_media(image_url, hwpack_url,
73- config.args, tools_dir)
74- else:
75- logging.error(
76- "Unable to find files that match the parameters specified")
77- exit(1)
78+ logging.error(
79+ "Unable to find files that match the parameters specified")
80+ exit(1)
81+ except subprocess.CalledProcessError, err_det:
82+ print "Command: ", err_det.cmd, err_det.output
83+ print "Image build failed"
84+ exit(1)
85
86 if __name__ == '__main__':
87 main()
88
89=== modified file 'linaro_fetch_image/fetch_image.py'
90--- linaro_fetch_image/fetch_image.py 2012-10-12 13:32:13 +0000
91+++ linaro_fetch_image/fetch_image.py 2012-10-16 10:45:25 +0000
92@@ -758,6 +758,9 @@
93
94 self.create_process = subprocess.Popen(lmc_command)
95 self.create_process.wait()
96+ if self.create_process.returncode:
97+ raise subprocess.CalledProcessError(1, lmc_command, 'Failed')
98+
99
100 class LinaroMediaCreate(threading.Thread):
101 """Thread class for running linaro-media-create"""

Subscribers

People subscribed via source and target branches