Merge ~cjwatson/launchpad:fix-snap-base-build-channels-by-arch into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 8f00fdb621fc9f36c4e0ac1b00d946a320fbac86
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-snap-base-build-channels-by-arch
Merge into: launchpad:master
Diff against target: 32 lines (+10/-4)
1 file modified
lib/lp/snappy/model/snap.py (+10/-4)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+407176@code.launchpad.net

Commit message

Fix Snap.requestBuildsFromJob to handle channels=None again

Description of the change

In https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/407094, I overlooked the fact that `Snap._pickChannels` can return None.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
2index 4eaa4ee..24aa2be 100644
3--- a/lib/lp/snappy/model/snap.py
4+++ b/lib/lp/snappy/model/snap.py
5@@ -892,7 +892,10 @@ class Snap(Storm, WebhookTargetMixin):
6 snap_base, snap_base_name = self._findBase(snapcraft_data)
7 distro_series = self._pickDistroSeries(snap_base, snap_base_name)
8 channels = self._pickChannels(snap_base, channels=channels)
9- channels_by_arch = channels.pop("_byarch", {})
10+ if channels is not None:
11+ channels_by_arch = channels.pop("_byarch", {})
12+ else:
13+ channels_by_arch = {}
14
15 # Sort by Processor.id for determinism. This is chosen to be
16 # the same order as in BinaryPackageBuildSet.createForSource, to
17@@ -916,9 +919,12 @@ class Snap(Storm, WebhookTargetMixin):
18 builds = []
19 for build_instance in architectures_to_build:
20 arch = build_instance.architecture
21- arch_channels = dict(channels)
22- if arch in channels_by_arch:
23- arch_channels.update(channels_by_arch[arch])
24+ if channels is not None:
25+ arch_channels = dict(channels)
26+ if arch in channels_by_arch:
27+ arch_channels.update(channels_by_arch[arch])
28+ else:
29+ arch_channels = None
30 try:
31 build = self.requestBuild(
32 requester, archive, supported_arches[arch], pocket,

Subscribers

People subscribed via source and target branches

to status/vote changes: