Look for plugins in a non-conflicting location

When we do plugin discovery, don't look in places that would cause our
plugins to be mixed up with docker's or vice-versa.  Drop plugin
management, since we don't talk to remote anything.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2016-07-19 14:11:47 -04:00
parent 2783450a92
commit 47d8aeb637
3 changed files with 24 additions and 23 deletions

View file

@ -15,8 +15,8 @@ import (
var ( var (
// ErrNotFound plugin not found // ErrNotFound plugin not found
ErrNotFound = errors.New("plugin not found") ErrNotFound = errors.New("plugin not found")
socketsPath = "/run/docker/plugins" socketsPath = "/run/oci-storage/plugins"
specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"} specsPaths = []string{"/etc/oci-storage/plugins", "/usr/lib/oci-storage/plugins"}
) )
// localRegistry defines a registry that is local (using unix socket). // localRegistry defines a registry that is local (using unix socket).

View file

@ -33,8 +33,8 @@ func TestFileSpecPlugin(t *testing.T) {
fail bool fail bool
}{ }{
// TODO Windows: Factor out the unix:// variants. // TODO Windows: Factor out the unix:// variants.
{filepath.Join(tmpdir, "echo.spec"), "echo", "unix://var/lib/docker/plugins/echo.sock", false}, {filepath.Join(tmpdir, "echo.spec"), "echo", "unix://var/lib/oci-storage/plugins/echo.sock", false},
{filepath.Join(tmpdir, "echo", "echo.spec"), "echo", "unix://var/lib/docker/plugins/echo.sock", false}, {filepath.Join(tmpdir, "echo", "echo.spec"), "echo", "unix://var/lib/oci-storage/plugins/echo.sock", false},
{filepath.Join(tmpdir, "foo.spec"), "foo", "tcp://localhost:8080", false}, {filepath.Join(tmpdir, "foo.spec"), "foo", "tcp://localhost:8080", false},
{filepath.Join(tmpdir, "foo", "foo.spec"), "foo", "tcp://localhost:8080", false}, {filepath.Join(tmpdir, "foo", "foo.spec"), "foo", "tcp://localhost:8080", false},
{filepath.Join(tmpdir, "bar.spec"), "bar", "localhost:8080", true}, // unknown transport {filepath.Join(tmpdir, "bar.spec"), "bar", "localhost:8080", true}, // unknown transport
@ -79,11 +79,11 @@ func TestFileJSONSpecPlugin(t *testing.T) {
p := filepath.Join(tmpdir, "example.json") p := filepath.Join(tmpdir, "example.json")
spec := `{ spec := `{
"Name": "plugin-example", "Name": "plugin-example",
"Addr": "https://example.com/docker/plugin", "Addr": "https://example.com/oci-storage/plugin",
"TLSConfig": { "TLSConfig": {
"CAFile": "/usr/shared/docker/certs/example-ca.pem", "CAFile": "/usr/shared/oci-storage/certs/example-ca.pem",
"CertFile": "/usr/shared/docker/certs/example-cert.pem", "CertFile": "/usr/shared/oci-storage/certs/example-cert.pem",
"KeyFile": "/usr/shared/docker/certs/example-key.pem" "KeyFile": "/usr/shared/oci-storage/certs/example-key.pem"
} }
}` }`
@ -101,19 +101,19 @@ func TestFileJSONSpecPlugin(t *testing.T) {
t.Fatalf("Expected plugin `plugin-example`, got %s\n", plugin.Name) t.Fatalf("Expected plugin `plugin-example`, got %s\n", plugin.Name)
} }
if plugin.Addr != "https://example.com/docker/plugin" { if plugin.Addr != "https://example.com/oci-storage/plugin" {
t.Fatalf("Expected plugin addr `https://example.com/docker/plugin`, got %s\n", plugin.Addr) t.Fatalf("Expected plugin addr `https://example.com/oci-storage/plugin`, got %s\n", plugin.Addr)
} }
if plugin.TLSConfig.CAFile != "/usr/shared/docker/certs/example-ca.pem" { if plugin.TLSConfig.CAFile != "/usr/shared/oci-storage/certs/example-ca.pem" {
t.Fatalf("Expected plugin CA `/usr/shared/docker/certs/example-ca.pem`, got %s\n", plugin.TLSConfig.CAFile) t.Fatalf("Expected plugin CA `/usr/shared/oci-storage/certs/example-ca.pem`, got %s\n", plugin.TLSConfig.CAFile)
} }
if plugin.TLSConfig.CertFile != "/usr/shared/docker/certs/example-cert.pem" { if plugin.TLSConfig.CertFile != "/usr/shared/oci-storage/certs/example-cert.pem" {
t.Fatalf("Expected plugin Certificate `/usr/shared/docker/certs/example-cert.pem`, got %s\n", plugin.TLSConfig.CertFile) t.Fatalf("Expected plugin Certificate `/usr/shared/oci-storage/certs/example-cert.pem`, got %s\n", plugin.TLSConfig.CertFile)
} }
if plugin.TLSConfig.KeyFile != "/usr/shared/docker/certs/example-key.pem" { if plugin.TLSConfig.KeyFile != "/usr/shared/oci-storage/certs/example-key.pem" {
t.Fatalf("Expected plugin Key `/usr/shared/docker/certs/example-key.pem`, got %s\n", plugin.TLSConfig.KeyFile) t.Fatalf("Expected plugin Key `/usr/shared/oci-storage/certs/example-key.pem`, got %s\n", plugin.TLSConfig.KeyFile)
} }
} }

View file

@ -1,17 +1,18 @@
// Package plugins provides structures and helper functions to manage Docker // Package plugins provides structures and helper functions to manage Docker
// plugins. // plugins.
// //
// Docker discovers plugins by looking for them in the plugin directory whenever // Storage discovers plugins by looking for them in the plugin directory whenever
// a user or container tries to use one by name. UNIX domain socket files must // a user or container tries to use one by name. UNIX domain socket files must
// be located under /run/docker/plugins, whereas spec files can be located // be located under /run/oci-storage/plugins, whereas spec files can be located
// either under /etc/docker/plugins or /usr/lib/docker/plugins. This is handled // either under /etc/oci-storage/plugins or /usr/lib/oci-storage/plugins. This
// by the Registry interface, which lets you list all plugins or get a plugin by // is handled by the Registry interface, which lets you list all plugins or get
// its name if it exists. // a plugin by its name if it exists.
// //
// The plugins need to implement an HTTP server and bind this to the UNIX socket // The plugins need to implement an HTTP server and bind this to the UNIX socket
// or the address specified in the spec files. // or the address specified in the spec files.
// A handshake is send at /Plugin.Activate, and plugins are expected to return // A handshake is send at /Plugin.Activate, and plugins are expected to return
// a Manifest with a list of of Docker subsystems which this plugin implements. // a Manifest with a list of subsystems which this plugin implements. As of
// this writing, the known subsystem is "GraphDriver".
// //
// In order to use a plugins, you can use the ``Get`` with the name of the // In order to use a plugins, you can use the ``Get`` with the name of the
// plugin and the subsystem it implements. // plugin and the subsystem it implements.
@ -52,7 +53,7 @@ type Manifest struct {
Implements []string Implements []string
} }
// Plugin is the definition of a docker plugin. // Plugin is the definition of a storage plugin.
type Plugin struct { type Plugin struct {
// Name of the plugin // Name of the plugin
name string name string