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

Proposed by Javier Collado
Status: Merged
Merged at revision: 793
Proposed branch: lp:~javier.collado/utah/bug1090013
Merge into: lp:utah
Diff against target: 70 lines (+8/-35)
1 file modified
utah/run.py (+8/-35)
To merge this branch: bzr merge lp:~javier.collado/utah/bug1090013
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+139753@code.launchpad.net

Description of the change

Removed the code that generated the empty reports.

This has been successfully tested for the pass runlist and also
forcing a failure in `machine.installclient`.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

This seems reasonable to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utah/run.py'
2--- utah/run.py 2012-12-06 16:30:34 +0000
3+++ utah/run.py 2012-12-13 17:22:21 +0000
4@@ -20,8 +20,6 @@
5 import os
6 import time
7 import urllib
8-import json
9-import yaml
10 import traceback
11
12 from utah import config
13@@ -47,49 +45,24 @@
14 machine.logger.error('Failed to run test: ' + str(error))
15 exitstatus = 1
16
17- _write(runlist, stdout)
18+ if stdout is not None:
19+ _write(runlist, stdout)
20
21 return exitstatus
22
23- def _write(runlist, report=None):
24+ def _write(runlist, report):
25 """Write runlist report.
26
27 Report will be written using appropriate filename based on the runlist.
28- If report is None becase there was some problem, then a default empty
29- report will be generated.
30+
31+ :param runlist: Path to the runlist file
32+ :type runlist: str
33+ :param report: Report to be written in any of the supported formats.
34+ :type report: str
35
36 """
37 timestamp = time.strftime('%Y-%m-%d_%H-%m-%S', time.gmtime())
38
39- if report is None:
40- # Generate default report with empty results to fake client output
41- default_report = {
42- 'runlist': runlist,
43- 'media-info': machine.image.media_info,
44- 'build_number': machine.image.buildnumber,
45- 'release': machine.image.series,
46- 'ran_at': timestamp,
47- 'install_type': machine.installtype,
48- 'arch': machine.arch,
49- 'commands': [],
50- 'fetch_errors': 0,
51- 'errors': 0,
52- 'failures': 0,
53- 'passes': 0,
54- 'uname': '',
55-
56-
57- }
58- if report_type == 'json':
59- report = json.dumps(default_report)
60- elif report_type == 'yaml':
61- report = yaml.dump(default_report,
62- explicit_start='---',
63- default_flow_style=False)
64- else:
65- raise ValueError('Unexpected report type: {}'
66- .format(report_type))
67-
68 listname = os.path.basename(runlist)
69 log_filename = ('{machine}_{runlist}_{timestamp}.{suffix}'
70 .format(machine=machine.name,

Subscribers

People subscribed via source and target branches