snappy: rename "migration-skill" to "old-security" and use new interface names instead of skills #518

Merged
merged 9 commits into from Mar 1, 2016

Conversation

Projects
None yet
5 participants
Collaborator

mvo5 commented Feb 24, 2016

This branch follows thenew interfaces approach and renames the following items:

  • migration-skill -> old-security
  • uses -> slots
  • offers -> plugs

It is pretty mechanical. Note that the integration tests will start failing. I will prepare new versions of all our examples so ideally we only merge once the new examples are uploaded.

mvo5 added some commits Feb 24, 2016

Member

elopio commented Feb 24, 2016

@sergiusens breakage is coming.

docs/security.md
-Most of the security aspects of the system will be done via skills and
-skill slots. However for compatibility with the 15.04 snappy
-architecture there is a special skill type called `migration-skill`
+Most of the security aspects of the system will be done via interfaces and
@elopio

elopio Feb 24, 2016

Member

replace the first and with a comma.

@mvo5

mvo5 Feb 24, 2016

Collaborator

Thanks, nice catch!

docs/security.md
-architecture there is a special skill type called `migration-skill`
+Most of the security aspects of the system will be done via interfaces and
+slots and plugs. However for compatibility with the 15.04 snappy
+architecture there is a special interface type called `old-security`
@elopio

elopio Feb 24, 2016

Member

From Gustavo's mail, I got that instead of saying "interface type" we should say only "interface".

@mvo5

mvo5 Feb 24, 2016

Collaborator

Good point.

snappy/click.go
if err := verifyStructStringsAgainstWhitelist(*uses, servicesBinariesStringsWhitelist); err != nil {
return err
}
- if uses.Type != "migration-skill" {
- return fmt.Errorf("can not use skill %q, only migration-skill supported", uses.Type)
+ if uses.Type != "old-security" {
@elopio

elopio Feb 24, 2016

Member

here should we change uses.Type to uses.Interface?

@mvo5

mvo5 Feb 24, 2016

Collaborator

Yes, nice catch. Let me fix that.

@mvo5 mvo5 closed this Feb 24, 2016

mvo5 added some commits Feb 24, 2016

@mvo5 mvo5 reopened this Feb 24, 2016

Contributor

sergiusens commented Feb 25, 2016

Does this really have more prio than getting the kernel snaps in place?

Contributor

zyga commented Feb 25, 2016

+1

snappy/security.go
- if len(app.UsesRef) != 1 {
- return nil, fmt.Errorf("only a single skill is supported, %d found", len(app.UsesRef))
+ if len(app.SlotsRef) != 1 {
+ return nil, fmt.Errorf("only a single skill is supported, %d found", len(app.SlotsRef))
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/skill/slot/

snappy/security.go
if !ok {
- return nil, fmt.Errorf("can not find skill %q", app.UsesRef[0])
+ return nil, fmt.Errorf("can not find skill %q", app.SlotsRef[0])
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/skill/slot/

docs/security.md
that can be used to migrate using the 15.04 syntax. See the example
-below for the various ways the migration-skill can be used.
+below for the various ways the `old-security` interface can be used.
## Security with the migration skill
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/migration skill/old-security interface/

snappy/click_test.go
- Type: "some-skill",
- }), ErrorMatches, ".*can not use skill.* only migration-skill supported")
+ c.Check(verifySlotYaml(&slotYaml{
+ Interface: "some-skill",
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/skill/interface/

snappy/security.go
@@ -742,17 +742,17 @@ func hasConfig(baseDir string) bool {
return helpers.FileExists(filepath.Join(baseDir, "meta", "hooks", "config"))
}
-func findSkillForApp(m *snapYaml, app *AppYaml) (*usesYaml, error) {
- if len(app.UsesRef) == 0 {
+func findSkillForApp(m *snapYaml, app *AppYaml) (*slotYaml, error) {
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/Skill/Slot/

snappy/security.go
}
- skill, ok := m.Uses[app.UsesRef[0]]
+ skill, ok := m.Slots[app.SlotsRef[0]]
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/skill/slot/

snappy/security_test.go
@@ -1044,7 +1044,7 @@ func (a *SecurityTestSuite) TestFindSkillForAppEmpty(c *C) {
func (a *SecurityTestSuite) TestFindSkillForAppTooMany(c *C) {
@niemeyer

niemeyer Feb 25, 2016

Contributor

s/Skill/Slot/ here and below.

docs/meta.md
@@ -77,9 +77,9 @@ The following keys are optional:
* `uses`: a map of names and skills
@niemeyer

niemeyer Feb 25, 2016

Contributor
* `slots`: a map of interfaces

We need more details here at some point, that'll do for now.

@niemeyer

niemeyer Feb 25, 2016

Contributor

There's also another entry for uses above which needs conversion. Can't comment there as it's out of the diff.

Contributor

niemeyer commented Feb 25, 2016

LGTM, just a few more occurrences to replace.

@sergiusens This is really not the place (or the tone) for that kind of conversation.

@niemeyer niemeyer added the Reviewed label Feb 26, 2016

mvo5 added some commits Feb 29, 2016

Collaborator

mvo5 commented Feb 29, 2016

@niemeyer thanks for this excellent review and sorry for overlooking these. I did a git grep -i skill and it seems this branch has them all now (except for the overlord/ package but AIUI this is a separate branch).

zyga commented on 8067567 Feb 29, 2016

+1

Collaborator

mvo5 commented Mar 1, 2016

retest this please

mvo5 added a commit that referenced this pull request Mar 1, 2016

Merge pull request #518 from mvo5/feature/capability-interfaces
snappy: rename "migration-skill" to "old-security" and use new interface names instead of skills

@mvo5 mvo5 merged commit 6610f0d into snapcore:master Mar 1, 2016

3 checks passed

Integration tests Success 67 tests run, 0 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.0%) to 70.519%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment