Merge lp:~sylvain-pineau/checkbox/gui_filter_testplan_by_id into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3598
Merged at revision: 3593
Proposed branch: lp:~sylvain-pineau/checkbox/gui_filter_testplan_by_id
Merge into: lp:checkbox
Diff against target: 80 lines (+28/-11)
3 files modified
checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp (+16/-4)
checkbox-gui/gui-engine/gui-engine.cpp (+4/-4)
checkbox-ng/checkbox_ng/service.py (+8/-3)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/gui_filter_testplan_by_id
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Sylvain Pineau (community) Needs Resubmitting
Review via email: mp+251080@code.launchpad.net

Description of the change

This MR allow gui launchers to work correctly with testplans since the whitelist_filter settings have to matching patterns again testplan id instead of testplan names.

Only checkbox-gui is patched, the existing launchers will continue to work.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :
Download full text (5.0 KiB)

14:56 <@zyga> spineau: revno 3593 does two logical changes, could you
split it please 14:56 <@zyga> spineau: specifically it doesn't say why
you use partial_id instead of the test plan name 14:57 <@zyga>
spineau: I think that using partial_id is asking for dbus path is
asking for trouble, could you use a hash of the full id insteda?
partial_id *will* clash and we'll spend a lot of time trying to debug
weird bugs from CE-QA 14:58 <@zyga> spineau: as for the second patch,
why are you ding the isValid() check there?

On Thu, Feb 26, 2015 at 2:20 PM, Sylvain Pineau
<email address hidden> wrote:
> Sylvain Pineau has proposed merging lp:~sylvain-pineau/checkbox/gui_filter_testplan_by_id into lp:checkbox.
>
> Requested reviews:
> Checkbox Developers (checkbox-dev)
>
> For more details, see:
> https://code.launchpad.net/~sylvain-pineau/checkbox/gui_filter_testplan_by_id/+merge/251080
>
> This MR allow gui launchers to work correctly with testplans since the whitelist_filter settings have to matching patterns again testplan id instead of testplan names.
>
> Only checkbox-gui is patched, the existing launchers will continue to work.
> --
> You are subscribed to branch lp:checkbox.
>
> === modified file 'checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp'
> --- checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp 2014-03-18 16:21:43 +0000
> +++ checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp 2015-02-26 13:19:17 +0000
> @@ -19,6 +19,8 @@
> * along with this program. If not, see <http://www.gnu.org/licenses/>.
> */
>
> +#include <QtDBus/QtDBus>
> +#include "../gui-engine/PBNames.h"
> #include "WhiteListModelFactory.h"
>
> ListModel* WhiteListModelFactory::CreateWhiteListModel(ListModel *model, const QString &filter)
> @@ -58,10 +60,22 @@
> while(iter != paths_and_names.end() ) {
> if (rx.exactMatch(iter.value())) {
> qDebug() << iter.key().path();
> - qDebug() << " Name: " << iter.value();
> - model->appendRow(new WhiteListItem(iter.value(), \
> - iter.key().path(), \
> - model));
> + // Connect to the introspectable interface
> + QDBusInterface introspect_iface(PBBusName, \
> + iter.key().path(), \
> + "org.freedesktop.DBus.Properties", \
> + QDBusConnection::sessionBus());
> + if (introspect_iface.isValid()) {
> + QDBusReply<QVariant> reply = introspect_iface.call("Get", \
> + "com.canonical.certification.PlainBox.WhiteList1", \
> + "name");
> + QVariant var(reply);
> + QString name(var.toString());
> + qDebug() << " Name: " << name;
> + model->appendRow(new WhiteListItem(name, \
> + iter.key().path(), \
> + model));
> + }
> }
> iter++;
> }
>
> === modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
> --- ch...

Read more...

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

cleaned commit history + unit checksum for testplan dbus object path

review: Needs Resubmitting
3594. By Sylvain Pineau

checkbox-ng:service: Use the unit.checksum for testplan object path

Instead of testplan names which may conflicts between providers, the dbus
object path for testplan is the unit checksum.

3595. By Sylvain Pineau

checkbox-ng:service: Expose the testplan partial_id property over dbus

Testplan partial_id will be used by launchers whitelist_filter regexp.
The test plan names will only be used for display.

3596. By Sylvain Pineau

checkbox-gui:gui-engine: paths_and_names values are now testplan partial_id

the gui launcher whitelist_filter was designed to find a match on id, not names.

3597. By Sylvain Pineau

checkbox-gui:WhiteListModelFactory: Use the testplan partial_id for rx.exactMatch()

Now that testplans are exposed over dbus, we can't use the testplan names
to find units matching the whitelist_filter of gui lauchers.

3598. By Sylvain Pineau

checkbox-gui:WhiteListModelFactory: Use testplan names for display

gui-engine is now getting the partial_id property to populate the paths_and_names
dictionary but WhiteListModelFactory::CreateWhiteListModel() will instead use
the testplan name for the model.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Thanks, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp'
2--- checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp 2014-03-18 16:21:43 +0000
3+++ checkbox-gui/checkbox-gui/WhiteListModelFactory.cpp 2015-02-26 15:17:26 +0000
4@@ -58,10 +58,22 @@
5 while(iter != paths_and_names.end() ) {
6 if (rx.exactMatch(iter.value())) {
7 qDebug() << iter.key().path();
8- qDebug() << " Name: " << iter.value();
9- model->appendRow(new WhiteListItem(iter.value(), \
10- iter.key().path(), \
11- model));
12+ // Connect to the introspectable interface
13+ QDBusInterface introspect_iface(PBBusName, \
14+ iter.key().path(), \
15+ "org.freedesktop.DBus.Properties", \
16+ QDBusConnection::sessionBus());
17+ if (introspect_iface.isValid()) {
18+ QDBusReply<QVariant> reply = introspect_iface.call("Get", \
19+ "com.canonical.certification.PlainBox.WhiteList1", \
20+ "name");
21+ QVariant var(reply);
22+ QString name(var.toString());
23+ qDebug() << " Name: " << name;
24+ model->appendRow(new WhiteListItem(name, \
25+ iter.key().path(), \
26+ model));
27+ }
28 }
29 iter++;
30 }
31
32=== modified file 'checkbox-gui/gui-engine/gui-engine.cpp'
33--- checkbox-gui/gui-engine/gui-engine.cpp 2015-02-25 23:54:36 +0000
34+++ checkbox-gui/gui-engine/gui-engine.cpp 2015-02-26 15:17:26 +0000
35@@ -358,12 +358,12 @@
36 if (introspect_iface.isValid()) {
37 QDBusReply<QVariant> reply = introspect_iface.call("Get", \
38 "com.canonical.certification.PlainBox.WhiteList1", \
39- "name");
40+ "partial_id");
41 QVariant var(reply);
42- QString name(var.toString());
43- qDebug() << name;
44+ QString partial_id(var.toString());
45+ qDebug() << partial_id;
46 // Only show the user whitelists with the desired prefix.
47- paths_and_names.insert(child->object_path,name);
48+ paths_and_names.insert(child->object_path, partial_id);
49 // First time round, fill in our whitelist member
50 if (!initialised) {
51 whitelist.insert(child->object_path, false);
52
53=== modified file 'checkbox-ng/checkbox_ng/service.py'
54--- checkbox-ng/checkbox_ng/service.py 2015-02-25 23:54:36 +0000
55+++ checkbox-ng/checkbox_ng/service.py 2015-02-26 15:17:26 +0000
56@@ -420,9 +420,7 @@
57 # Some internal helpers
58
59 def _get_preferred_object_path(self):
60- # TODO: this clashes with providers, maybe use a random ID instead
61- return "/plainbox/whitelist/{}".format(
62- mangle_object_path(self.native.name))
63+ return "/plainbox/whitelist/{}".format(self.native.checksum)
64
65 # Value added
66
67@@ -433,6 +431,13 @@
68 """
69 return self.native.name or ""
70
71+ @dbus.service.property(dbus_interface=WHITELIST_IFACE, signature="s")
72+ def partial_id(self):
73+ """
74+ partial_id of this testplan
75+ """
76+ return self.native.partial_id or ""
77+
78
79 class JobResultWrapper(PlainBoxObjectWrapper):
80 """

Subscribers

People subscribed via source and target branches