Merge ~sylvain-pineau/plainbox:empty_resource into plainbox:master

Proposed by Sylvain Pineau on 2017-07-06
Status: Merged
Approved by: Sylvain Pineau on 2017-07-06
Approved revision: 461bd85fb1c49c0ce54bde3cd8867a604118a2fc
Merged at revision: 491fab08df0c10b9feaee04977910e543d6779aa
Proposed branch: ~sylvain-pineau/plainbox:empty_resource
Merge into: plainbox:master
Diff against target: 13 lines (+3/-0)
1 file modified
plainbox/impl/ (+3/-0)
Reviewer Review Type Date Requested Status
Maciej Kisielewski 2017-07-06 Approve on 2017-07-06
Review via email:

Description of the change

This patch avoids job requirements to fail if one resource object has no records.

Tested with mediacard/sd-preinserted on a system with no snaps installed

To post a comment you must log in.
Maciej Kisielewski (kissiel) wrote :

I like it!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plainbox/impl/ b/plainbox/impl/
2index 0ad1a47..ac019fa 100644
3--- a/plainbox/impl/
4+++ b/plainbox/impl/
5@@ -295,6 +295,9 @@ class CheckBoxSessionStateController(ISessionStateController):
7 _("Storing resource record %r: %s"),, resource)
8 new_resource_list.append(resource)
9+ # Create an empty resource object to properly fail __getattr__ calls
10+ if not new_resource_list:
11+ new_resource_list = [Resource({})]
12 # Replace any old resources with the new resource list
13 session_state.set_resource_list(, new_resource_list)


People subscribed via source and target branches