浏览代码

replace active by enabled for consistency in plugins

Signed-off-by: Victor Vieux <vieux@docker.com>
Victor Vieux 9 年之前
父节点
当前提交
cf4e268115

+ 2 - 2
api/client/plugin/list.go

@@ -45,7 +45,7 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
 	}
 
 	w := tabwriter.NewWriter(dockerCli.Out(), 20, 1, 3, ' ', 0)
-	fmt.Fprintf(w, "NAME \tTAG \tDESCRIPTION\tACTIVE")
+	fmt.Fprintf(w, "NAME \tTAG \tDESCRIPTION\tENABLED")
 	fmt.Fprintf(w, "\n")
 
 	for _, p := range plugins {
@@ -55,7 +55,7 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
 			desc = stringutils.Ellipsis(desc, 45)
 		}
 
-		fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", p.Name, p.Tag, desc, p.Active)
+		fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", p.Name, p.Tag, desc, p.Enabled)
 	}
 	w.Flush()
 	return nil

+ 3 - 7
docs/reference/commandline/plugin_disable.md

@@ -25,12 +25,12 @@ see [`docker plugin install`](plugin_install.md).
 
 
 The following example shows that the `no-remove` plugin is installed
-and active:
+and enabled:
 
 ```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   true
 ```
 
@@ -40,14 +40,10 @@ To disable the plugin, use the following command:
 $ docker plugin disable tiborvass/no-remove
 
 tiborvass/no-remove
-```
-
-After the plugin is disabled, it appears as "inactive" in the list of plugins:
 
-```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   false
 ```
 

+ 3 - 7
docs/reference/commandline/plugin_enable.md

@@ -25,12 +25,12 @@ see [`docker plugin install`](plugin_install.md).
 
 
 The following example shows that the `no-remove` plugin is installed,
-but disabled ("inactive"):
+but disabled:
 
 ```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   false
 ```
 
@@ -40,14 +40,10 @@ To enable the plugin, use the following command:
 $ docker plugin enable tiborvass/no-remove
 
 tiborvass/no-remove
-```
-
-After the plugin is enabled, it appears as "active" in the list of plugins:
 
-```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   true
 ```
 

+ 1 - 1
docs/reference/commandline/plugin_inspect.md

@@ -33,7 +33,7 @@ $ docker plugin inspect tiborvass/no-remove:latest
   "Id": "8c74c978c434745c3ade82f1bc0acf38d04990eaf494fa507c16d9f1daa99c21",
   "Name": "tiborvass/no-remove",
   "Tag": "latest",
-  "Active": true,
+  "Enabled": true,
   "Config": {
     "Mounts": [
       {

+ 1 - 1
docs/reference/commandline/plugin_install.md

@@ -47,7 +47,7 @@ After the plugin is installed, it appears in the list of plugins:
 ```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   true
 ```
 

+ 1 - 1
docs/reference/commandline/plugin_ls.md

@@ -32,7 +32,7 @@ Example output:
 ```bash
 $ docker plugin ls
 
-NAME                  TAG                 DESCRIPTION                ACTIVE
+NAME                  TAG                 DESCRIPTION                ENABLED
 tiborvass/no-remove   latest              A test plugin for Docker   true
 ```
 

+ 1 - 1
docs/reference/commandline/plugin_rm.md

@@ -24,7 +24,7 @@ Options:
           --help   Print usage
 ```
 
-Removes a plugin. You cannot remove a plugin if it is active, you must disable
+Removes a plugin. You cannot remove a plugin if it is enabled, you must disable
 a plugin using the [`docker plugin disable`](plugin_disable.md) before removing
 it (or use --force, use of force is not recommended, since it can affect
 functioning of running containers using the plugin).

+ 1 - 1
hack/vendor.sh

@@ -61,7 +61,7 @@ clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://gith
 clone git github.com/docker/go-units eb879ae3e2b84e2a142af415b679ddeda47ec71c
 clone git github.com/docker/go-connections fa2850ff103453a9ad190da0df0af134f0314b3d
 
-clone git github.com/docker/engine-api ebc51d1954fc8934307dd15841b8d64f7cd505df
+clone git github.com/docker/engine-api 94a8f8f29307ab291abad6c6f2182d67089aae5d
 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837
 clone git github.com/imdario/mergo 0.2.1
 

+ 2 - 2
integration-cli/docker_cli_plugins_test.go

@@ -42,7 +42,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
 	c.Assert(err, checker.IsNil)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
-	c.Assert(out, checker.Contains, "is active")
+	c.Assert(out, checker.Contains, "is enabled")
 
 	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
 	c.Assert(err, checker.IsNil)
@@ -63,7 +63,7 @@ func (s *DockerSuite) TestPluginForceRemove(c *check.C) {
 	c.Assert(err, checker.IsNil)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
-	c.Assert(out, checker.Contains, "is active")
+	c.Assert(out, checker.Contains, "is enabled")
 
 	out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
 	c.Assert(err, checker.IsNil)

+ 4 - 4
plugin/manager.go

@@ -84,7 +84,7 @@ func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin {
 
 func (pm *Manager) restorePlugin(p *plugin) error {
 	p.runtimeSourcePath = filepath.Join(pm.runRoot, p.PluginObj.ID)
-	if p.PluginObj.Active {
+	if p.PluginObj.Enabled {
 		return pm.restore(p)
 	}
 	return nil
@@ -321,7 +321,7 @@ func (pm *Manager) init() error {
 
 			pm.Lock()
 			pm.nameToID[p.Name()] = p.PluginObj.ID
-			requiresManualRestore := !pm.liveRestore && p.PluginObj.Active
+			requiresManualRestore := !pm.liveRestore && p.PluginObj.Enabled
 			pm.Unlock()
 
 			if requiresManualRestore {
@@ -369,9 +369,9 @@ func (pm *Manager) initPlugin(p *plugin) error {
 }
 
 func (pm *Manager) remove(p *plugin, force bool) error {
-	if p.PluginObj.Active {
+	if p.PluginObj.Enabled {
 		if !force {
-			return fmt.Errorf("plugin %s is active", p.Name())
+			return fmt.Errorf("plugin %s is enabled", p.Name())
 		}
 		if err := pm.disable(p); err != nil {
 			logrus.Errorf("failed to disable plugin '%s': %s", p.Name(), err)

+ 7 - 7
plugin/manager_linux.go

@@ -21,7 +21,7 @@ import (
 )
 
 func (pm *Manager) enable(p *plugin, force bool) error {
-	if p.PluginObj.Active && !force {
+	if p.PluginObj.Enabled && !force {
 		return fmt.Errorf("plugin %s is already enabled", p.Name())
 	}
 	spec, err := pm.initSpec(p)
@@ -47,7 +47,7 @@ func (pm *Manager) enable(p *plugin, force bool) error {
 	}
 
 	pm.Lock() // fixme: lock single record
-	p.PluginObj.Active = true
+	p.PluginObj.Enabled = true
 	pm.save()
 	pm.Unlock()
 
@@ -130,7 +130,7 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) {
 }
 
 func (pm *Manager) disable(p *plugin) error {
-	if !p.PluginObj.Active {
+	if !p.PluginObj.Enabled {
 		return fmt.Errorf("plugin %s is already disabled", p.Name())
 	}
 	if err := p.restartManager.Cancel(); err != nil {
@@ -142,7 +142,7 @@ func (pm *Manager) disable(p *plugin) error {
 	os.RemoveAll(p.runtimeSourcePath)
 	pm.Lock() // fixme: lock single record
 	defer pm.Unlock()
-	p.PluginObj.Active = false
+	p.PluginObj.Enabled = false
 	pm.save()
 	return nil
 }
@@ -156,8 +156,8 @@ func (pm *Manager) Shutdown() {
 	pm.RLock()
 	defer pm.RUnlock()
 	for _, p := range pm.plugins {
-		if pm.liveRestore && p.PluginObj.Active {
-			logrus.Debug("Plugin active when liveRestore is set, skipping shutdown")
+		if pm.liveRestore && p.PluginObj.Enabled {
+			logrus.Debug("Plugin enabled when liveRestore is set, skipping shutdown")
 			continue
 		}
 		if p.restartManager != nil {
@@ -165,7 +165,7 @@ func (pm *Manager) Shutdown() {
 				logrus.Error(err)
 			}
 		}
-		if pm.containerdClient != nil && p.PluginObj.Active {
+		if pm.containerdClient != nil && p.PluginObj.Enabled {
 			p.exitChan = make(chan bool)
 			err := pm.containerdClient.Signal(p.PluginObj.ID, int(syscall.SIGTERM))
 			if err != nil {

+ 5 - 4
vendor/src/github.com/docker/engine-api/types/plugin.go

@@ -26,10 +26,11 @@ type PluginConfig struct {
 
 // Plugin represents a Docker plugin for the remote API
 type Plugin struct {
-	ID       string `json:"Id,omitempty"`
-	Name     string
-	Tag      string
-	Active   bool
+	ID   string `json:"Id,omitempty"`
+	Name string
+	Tag  string
+	// Enabled is true when the plugin is running, is false when the plugin is not running, only installed.
+	Enabled  bool
 	Config   PluginConfig
 	Manifest PluginManifest
 }