Merge lp:~javier.collado/utah/bug1029493 into lp:utah

Proposed by Javier Collado
Status: Merged
Merged at revision: 590
Proposed branch: lp:~javier.collado/utah/bug1029493
Merge into: lp:utah
Diff against target: 36 lines (+6/-6)
1 file modified
utah/client/runner.py (+6/-6)
To merge this branch: bzr merge lp:~javier.collado/utah/bug1029493
Reviewer Review Type Date Requested Status
Javier Collado (community) Needs Resubmitting
Joe Talbott (community) Needs Fixing
Review via email: mp+117518@code.launchpad.net

Description of the change

To get the runlist when passed as a URL, these changes use urllib.urlretrieve
the same way as the code for run_utah_tests.py does.

Note that self.master_runlist isn't updated with the name of the temporary file
created after the download (local_filename). This should be fine as long as the
rest of the code that uses self.master_runlist doesn't assume it's a local
filename (please let me know if that's the case).

Finally, I tested the changes with both a local master.run example and the one
from the dev branch in launchpad and it worked fine:
http://bazaar.launchpad.net/~utah/utah/dev/download/head:/master.run-20120327155825-koxr3z6b4j69spb3-6/master.run

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

Please add a comment in the code indicating that self.master_runlist points to the originally passed in runlist and not the local file to avoid future confusion. Other than that, looks great. Thanks!

review: Needs Fixing
lp:~javier.collado/utah/bug1029493 updated
583. By Javier Collado

Added comments as suggested by Joe's review

Revision history for this message
Javier Collado (javier.collado) wrote :

Good idea, comments added.

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utah/client/runner.py'
2--- utah/client/runner.py 2012-07-31 20:27:32 +0000
3+++ utah/client/runner.py 2012-07-31 20:34:19 +0000
4@@ -9,6 +9,7 @@
5 import shutil
6 import stat
7 import yaml
8+import urllib
9
10 from common import MASTER_RUNLIST, UTAH_DIR, DEFAULT_STATE_FILE
11 from common import RETURN_CODES
12@@ -35,6 +36,7 @@
13 def __init__(self, runlist=MASTER_RUNLIST, result_class=Result,
14 testdir=UTAH_DIR, state_agent=None, resume=False):
15
16+ # Runlist URL passed through the command line
17 self.master_runlist = runlist
18 self.testdir = testdir
19 self.suites = []
20@@ -244,13 +246,11 @@
21 fetch_cmd: get foo
22 - include: another_master.run
23 """
24-
25- try:
26- fp = open(self.master_runlist, 'r')
27+ # Download runlist using the URL passed through the commmand line to
28+ # local filename if needed (it might be a local file already or cached)
29+ local_filename = urllib.urlretrieve(self.master_runlist)[0]
30+ with open(local_filename, 'r') as fp:
31 data = yaml.load(fp)
32- fp.close()
33- except IOError as e:
34- raise exceptions.MissingFile(str(e))
35
36 seen = []
37

Subscribers

People subscribed via source and target branches