Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
many: derive implicit slots from interface meta-data #3370
Conversation
| - // XXX: AddImplicitSlots is really a brittle interface | ||
| - snap.AddImplicitSlots(snapInfo) | ||
| + // XXX: addImplicitSlots is really a brittle interface | ||
| + addImplicitSlots(snapInfo) |
pedronis
May 22, 2017
Contributor
can't we try to address the problem that is still brittle given that we are changing things ?
zyga
Jun 5, 2017
Contributor
Yes but this is not something I wish to do in this branch. The goal right now is to reduce the number of files that need to be patched to create a new interface. Addressing the implicit slot mechanism can and should be done separately IMO. I think this branch does improve the situation slightly as it moves the code closer to the interface manager where ultimately all the interface decisions are being taken.
codecov-io
commented
Jun 5, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3370 +/- ##
==========================================
- Coverage 77.56% 77.21% -0.35%
==========================================
Files 371 372 +1
Lines 25519 25630 +111
==========================================
- Hits 19793 19791 -2
- Misses 3976 4089 +113
Partials 1750 1750
Continue to review full report at Codecov.
|
mvo5
reviewed
Jun 7, 2017
Looks good, I welcome the change to only have to touch a single file instead having to touch things all over the map when implementing a new interfaces. Some ideas/questions, but the code looks good, maybe worthwhile to get a quick look from @niemeyer about the design of this.
| @@ -72,6 +72,8 @@ func init() { | ||
| name: "account-control", | ||
| summary: accountControlSummary, | ||
| description: accountControlDescription, | ||
| + implicitOnCore: true, |
mvo5
Jun 7, 2017
Collaborator
Is there/will there ever be a case where we have implicitOnCore: false, implicitOnClassic: true ? The old code had implicit and implicitOnlyOnClassic only. Mostly wondering. Also wondering if: implicit: All, implicit: CoreOnly, implicit: ClassicOnly might look nicer (i.e. using bits).
zyga
Jun 7, 2017
Contributor
There are things that are implicit on classic, yes. I changed this from the previous code to make it less magic and more obvious as to what is added. I don't mind a single implicit bit-flag but I'd rather do that in a separate branch to allow this one to land and iterate.
| - summary: fuseSupportSummary, | ||
| - connectedPlugAppArmor: fuseSupportConnectedPlugAppArmor, | ||
| - connectedPlugSecComp: fuseSupportConnectedPlugSecComp, | ||
| - reservedForOS: true, |
mvo5
Jun 7, 2017
Collaborator
Why is this not just adding something like:
registerIface(&commonInterface{
...
ImplicitOnClassic: !(release.ReleaseInfo.ID == "ubuntu" && release.ReleaseInfo.VersionID == "14.04"),
...
}
i.e. why did it have to be converted to a new type?
| - // Ensure that we have *some* implicit slots | ||
| - c.Assert(len(info.Slots) > 10, Equals, true) | ||
| -} | ||
| +type implicitSuite struct{} |
zyga
Jun 7, 2017
Contributor
There are some things that we could test, I think. I can remove it or fill in the tests.
jdstrand
approved these changes
Jun 7, 2017
+1 to land as is. The interfaces are all in the right place. I did request an additional test. I also agree with others that need to fill in two variables for something that is implicit everywhere is slightly awkward. Please consider making this easier either as part of this PR or a (soonish) upcoming PR.
| registerIface(&commonInterface{ | ||
| name: "fuse-support", | ||
| summary: fuseSupportSummary, | ||
| + implicitOnCore: true, | ||
| + implicitOnClassic: !(release.ReleaseInfo.ID == "ubuntu" && release.ReleaseInfo.VersionID == "14.04"), |
jdstrand
Jun 7, 2017
Contributor
This looks like an unrelated change. I'm not saying it is wrong.... It seems that this sort of thing should be captured elsewhere. Eg, I can imagine Fedora or SUSE might have different interfaces. I mention this only because if going that direction, maybe it's best to not include this change in this PR.
zyga
Jun 8, 2017
Contributor
This is not an unrelated change. It used to be defined exactly this way in implicit.go before.
| + c.Assert(info.Slots["network"].Name, Equals, "network") | ||
| + c.Assert(info.Slots["network"].Snap, Equals, info) | ||
| + // Ensure that we have *some* implicit slots | ||
| + c.Assert(len(info.Slots) > 10, Equals, true) |
zyga commentedMay 22, 2017
•
Edited 1 time
-
zyga
May 22, 2017
This patch moves the declaration that a given interface should have an
implicit slot on the core snap from snap/implicit.go into each
particular interface definition file. This brings us closer to having
all the relevant code for a given interface be entirely defined in the
interface file itself.
The fuse-support interface had some extra complexity that was now merged
into the interface definition (it is not implicitly added on ubuntu
14.04). The interface code had to be changed from commonInterface to a
new dedicated type.
The code that adds interfaces is now moved to overlord/ifacecstate and
made private (it is only relevant there and it avoids cyclic imports).
Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com