snap: ensure that plug and slot names are unique #1848

Merged
merged 2 commits into from Sep 5, 2016

Conversation

Projects
None yet
3 participants
Contributor

zyga commented Sep 5, 2016

This branch extended snap validation to ensure that plug and slot names are unique within one snap so that a given name is always uniquely identifying a plug or a slot but not both.

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

zyga added some commits Sep 5, 2016

snap: ensure that plug and slot names are unique
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
snap: add test for plug and slot uniqueness
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Contributor

niemeyer commented Sep 5, 2016

LGTM. Let's just wait for tests.

@niemeyer niemeyer merged commit af6ec8c into snapcore:master Sep 5, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@zyga zyga deleted the zyga:validate-plug-slot-uniqueness branch Sep 6, 2016

Contributor

jdstrand commented Sep 12, 2016

Hrmmm, I'm curious about the motivation for this. For example, the docker snap was going to use:

apps:
  docker:
    command: docker-wrapper docker
    plugs:
      - docker
      - network
      - home

  dockerd:
    command: dockerd-wrapper
    daemon: simple
    plugs:
      - network-bind
      - firewall-control
    slots:
      - docker

In this manner we wouldn't have a 'docker-client' interface and a 'docker' interface, but could just use one for each.

This can be worked around with:

plugs:
  docker-cli:
    interface: docker
slots:
  docker-daemon:
    interface: docker

apps:
  docker:
    command: command-docker.wrapper
    plugs:
    - docker-cli
    - network
    - home
  dockerd:
    command: command-dockerd.wrapper
    daemon: simple
    plugs:
    - network-bind
    - firewall-control
    slots:
    - docker-daemon

but I don't understand the point of the PR if this is supposed to work. I'll discuss on IRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment