Merge lp:~oem-qa/checkbox-editor/784583 into lp:checkbox-editor

Proposed by Sylvain Pineau
Status: Merged
Approved by: Javier Collado
Approved revision: 134
Merged at revision: 133
Proposed branch: lp:~oem-qa/checkbox-editor/784583
Merge into: lp:checkbox-editor
Diff against target: 52 lines (+15/-3)
3 files modified
checkbox_editor/editor.py (+4/-1)
checkbox_editor/model.py (+4/-0)
checkbox_editor/whitelist.py (+7/-2)
To merge this branch: bzr merge lp:~oem-qa/checkbox-editor/784583
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Review via email: mp+69260@code.launchpad.net

Description of the change

Add .* suffix in whitelist parameter/files for every remote* jobs (LP #784583)

To post a comment you must log in.
lp:~oem-qa/checkbox-editor/784583 updated
134. By Sylvain Pineau

Fix whitelist parameter generation

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

@Sylvain

Thanks for this merge proposal. I think that the assumption that every remote job will generate children job names that start with the same prefix is a safe one (at least for checkbox-oem).

There is one issue with the code. The text that is displayed in the whitelist view is escaped using re.escape so any string that ends with '.*' is saved as '\.\*' which is not what you're trying to do.

I'll think about a way to fix this while keeping the whitelist view as friendly as possible (probably regular expression patterns shouldn't be displayed there) before you come back from vacation so this is just a reminder for myself.

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

@Sylvain

I've changed the original code as explained in the bzr commit message:
---------------
  Add .* suffix in whitelist parameter/files for every remote* jobs

  It's assumed that all remote jobs will generate job names that start
  with the same name as a prefix (otherwise this change would be
  useless).

  Also, it's assumed that no other job name starts with the same prefix
  (otherwise that job would be unintentionally whitelisted).

  The transformation from selected job name to pattern happens at two
  different places:
  - when the current whitelist is executed
  - when the current whitelist is saved

  Aside from that the transformation from job name to patterns is pretty
  much transparent to the user, that is, the rows being selected are
  exposed, but not the pattern names generated.
---------------

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox_editor/editor.py'
2--- checkbox_editor/editor.py 2011-06-22 22:25:55 +0000
3+++ checkbox_editor/editor.py 2011-07-26 14:32:45 +0000
4@@ -878,7 +878,10 @@
5 for row in model.get_selected_rows(include_resources=whitelist_resources):
6 description = row[model.DESCRIPTION]
7 if description and 'name' in description:
8- yield description['name']
9+ if 'plugin' in description and 'remote' in description['plugin']:
10+ yield description['name']+'.*'
11+ else:
12+ yield description['name']
13
14 command = '{0} -w "{1}"'.format(self.preferences.general['checkbox_binary'],
15 ' '.join(selected_row_names()))
16
17=== modified file 'checkbox_editor/model.py'
18--- checkbox_editor/model.py 2011-07-22 21:53:39 +0000
19+++ checkbox_editor/model.py 2011-07-26 14:32:45 +0000
20@@ -1340,7 +1340,11 @@
21 description = row[self.DESCRIPTION]
22 if description:
23 name = description.get('name')
24+ plugin = description.get('plugin')
25 if name:
26+ if plugin:
27+ if 'remote' in plugin:
28+ name = name+'.*'
29 if value:
30 self.whitelist.append(name)
31 else:
32
33=== modified file 'checkbox_editor/whitelist.py'
34--- checkbox_editor/whitelist.py 2011-06-23 12:10:24 +0000
35+++ checkbox_editor/whitelist.py 2011-07-26 14:32:45 +0000
36@@ -334,10 +334,15 @@
37 description = row[self.main_model.DESCRIPTION]
38 if (description and 'name' in description
39 and pattern.match(description['name'])):
40+ name = description['name']
41+ plugin = description['plugin']
42+ if plugin:
43+ if 'remote' in plugin:
44+ name = name+'.*'
45 logging.debug('{0} selected because of pattern {1}'
46- .format(repr(description['name']),
47+ .format(repr(name),
48 repr(pattern.pattern)))
49- self.append(description['name'])
50+ self.append(name)
51 row[self.main_model.SELECTED] = True
52 pattern_matched = True
53

Subscribers

People subscribed via source and target branches

to all changes: