Merge lp:~kissiel/checkbox/output-variable-in-launchers into lp:checkbox

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4518
Merged at revision: 4518
Proposed branch: lp:~kissiel/checkbox/output-variable-in-launchers
Merge into: lp:checkbox
Diff against target: 87 lines (+39/-6)
3 files modified
checkbox-ng/docs/launcher-tutorial.rst (+23/-0)
checkbox-ng/launchers/checkbox-cli (+9/-6)
plainbox/plainbox/impl/launcher.py (+7/-0)
To merge this branch: bzr merge lp:~kissiel/checkbox/output-variable-in-launchers
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+307760@code.launchpad.net

Description of the change

This MR adds 'output' setting to [ui] section for launchers.

    That setting specifies which jobs should have their command output printed on the screen. There are 3 options:
    * hide -> (Command output hidden) will be printed for all jobs
    * hide-resource-and-attachment -> will hide output from those two plugin types (as well from (deprecated) local jobs)
    * show (the default setting) -> will print output of all commands

    Note that job that have 'suppress_output' flag will have their output always hidden.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Just tested all combinations, they work as expected. Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-ng/docs/launcher-tutorial.rst'
2--- checkbox-ng/docs/launcher-tutorial.rst 2016-09-08 07:18:23 +0000
3+++ checkbox-ng/docs/launcher-tutorial.rst 2016-10-05 20:01:33 +0000
4@@ -209,9 +209,31 @@
5
6 ``dont_suppress_output``
7
8+.. note::
9+
10+ This field is deprecated, use 'output' to specify which jobs should have
11+ their output printed to the screen.
12+
13 Setting this field to ``yes`` disables hiding of command output for jobs of
14 type ``local``, ``resource`` and ``attachment``. Default value: ``no``.
15
16+``output``
17+
18+This setting lets you hide output of commands run by checkbox. It can be set to
19+one of the following values:
20+
21+- ``show`` - output of all jobs will be printed
22+- ``hide`` - commands' output will be hidden
23+- ``hide-resource-and-attachment`` - output of resource and attachment jobs
24+ will be hidden, output of other job types will be printed
25+
26+Default value: ``show``
27+
28+.. note::
29+
30+ Individual jobs can have their output hidden by specifying
31+ 'suppress-output' in their definition.
32+
33 Restart section
34 ===============
35
36@@ -421,6 +443,7 @@
37
38 [ui]
39 type = silent
40+ output = hide
41
42 [transport:certification]
43 type = certification
44
45=== modified file 'checkbox-ng/launchers/checkbox-cli'
46--- checkbox-ng/launchers/checkbox-cli 2016-09-30 08:02:23 +0000
47+++ checkbox-ng/launchers/checkbox-cli 2016-10-05 20:01:33 +0000
48@@ -437,12 +437,15 @@
49 estimated_time -= job.estimated_duration
50
51 def _get_ui_for_job(self, job):
52- if not self.launcher.dont_suppress_output and (job.plugin in (
53- 'local', 'resource', 'attachment') or
54- 'suppress-output' in job.get_flag_set()):
55- return CheckboxUI(self.C.c, show_cmd_output=False)
56- else:
57- return CheckboxUI(self.C.c, show_cmd_output=True)
58+ show_out = True
59+ if self.launcher.output == 'hide-resource-and-attachment':
60+ if job.plugin in ('local', 'resource', 'attachment'):
61+ show_out = False
62+ elif self.launcher.output == 'hide':
63+ show_out = False
64+ if 'suppress-output' in job.get_flag_set():
65+ show_out = False
66+ return CheckboxUI(self.C.c, show_cmd_output=show_out)
67
68 def _run_single_job_with_ui_loop(self, job, ui):
69 print(self.C.header(job.tr_summary(), fill='-'))
70
71=== modified file 'plainbox/plainbox/impl/launcher.py'
72--- plainbox/plainbox/impl/launcher.py 2016-08-03 18:27:47 +0000
73+++ plainbox/plainbox/impl/launcher.py 2016-10-05 20:01:33 +0000
74@@ -248,6 +248,13 @@
75 ['interactive', 'silent', 'converged', 'converged-silent'])],
76 help_text=_('Type of stock user interface to use.'))
77
78+ output = config.Variable(
79+ section='ui',
80+ default='show',
81+ validator_list=[config.ChoiceValidator(
82+ ['show', 'hide', 'hide-resource-and-attachment'])],
83+ help_text=_('Silence or restrict command output'))
84+
85 dont_suppress_output = config.Variable(
86 section="ui", kind=bool, default=False,
87 help_text=_("Don't suppress the output of certain job plugin types."))

Subscribers

People subscribed via source and target branches