mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
replace active by enabled for consistency in plugins
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
4844d13bd7
commit
cf4e268115
12 changed files with 31 additions and 38 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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": [
|
||||
{
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue