Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
interfaces: validate plug/slot uniqueness #3153
Conversation
zyga
added some commits
Apr 7, 2017
zyga
added this to the
2.24 milestone
Apr 7, 2017
|
This can only land after we land #3154 |
zyga
referenced this pull request
Apr 7, 2017
Closed
overlord/ifacestate: fix auto-connect during core snap transition #3145
|
This branch depends on #3154 |
niemeyer
approved these changes
Apr 10, 2017
LGTM. Just a suggestion for the messaging:
| - if _, ok := r.plugs[plug.Snap.Name()][plug.Name]; ok { | ||
| - return fmt.Errorf("cannot add plug, snap %q already has plug %q", plug.Snap.Name(), plug.Name) | ||
| + if _, ok := r.plugs[snapName][plug.Name]; ok { | ||
| + return fmt.Errorf("cannot add plug %q, snap %q already has a plug with that name", plug.Name, snapName) |
niemeyer
Apr 10, 2017
•
Contributor
From the user perspective, there's no plug or slot being added. I suggest reporting this as:
"snap %q has plugs conflicting on name %q"
"snap %q has plug and slot conflicting on name %q"
and so on.
zyga
added some commits
Apr 10, 2017
| - if _, ok := r.plugs[plug.Snap.Name()][plug.Name]; ok { | ||
| - return fmt.Errorf("cannot add plug, snap %q already has plug %q", plug.Snap.Name(), plug.Name) | ||
| + if _, ok := r.plugs[snapName][plug.Name]; ok { | ||
| + return fmt.Errorf("snap %q has plug and slot conflicting on name %q", snapName, plug.Name) |
niemeyer
Apr 10, 2017
Contributor
In this case it's plug and plug. Per the original comment here:
"snap %q has plugs conflicting on name %q"
| - if _, ok := r.slots[slot.Snap.Name()][slot.Name]; ok { | ||
| - return fmt.Errorf("cannot add slot, snap %q already has slot %q", slot.Snap.Name(), slot.Name) | ||
| + if _, ok := r.slots[snapName][slot.Name]; ok { | ||
| + return fmt.Errorf("snap %q has plug and slot conflicting on name %q", snapName, slot.Name) |
zyga
added some commits
Apr 10, 2017
mvo5
modified the milestones:
2.25,
2.24
Apr 11, 2017
zyga
merged commit 8ac2f82
into
snapcore:master
Apr 11, 2017
6 checks passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
xenial-amd64
autopkgtest finished (success)
Details
xenial-i386
autopkgtest finished (success)
Details
xenial-ppc64el
autopkgtest finished (success)
Details
yakkety-amd64
autopkgtest finished (success)
Details
zesty-amd64
autopkgtest finished (success)
Details
zyga
deleted the
zyga:unique-plug-slot-names
branch
Apr 11, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zyga commentedApr 7, 2017
This branch improves validation of changes made to the interfaces repository. In the past this was done
at
snap.Infolevel, specifically viasnap.Validatebut this was ignoring additional changes caused byadding implicit plug or slot names. This has caused a bug where the
coresnap would define some plugsdirectly in the YAML file (specifically
network-bindplug) and and than would gain implicitnetwork-bindslot through the implicit mechanism. Now direct additions of plugs and slots are also enforcing the uniqueness constraint.NOTE: This branch might only be clean to land after the new core snap is released.