Skip to content

Commit

Permalink
replace active by enabled for consistency in plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Vieux <[email protected]>
  • Loading branch information
vieux committed Aug 26, 2016
1 parent 4844d13 commit cf4e268
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 38 deletions.
4 changes: 2 additions & 2 deletions api/client/plugin/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions docs/reference/commandline/plugin_disable.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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
```

Expand Down
10 changes: 3 additions & 7 deletions docs/reference/commandline/plugin_enable.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commandline/plugin_inspect.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commandline/plugin_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commandline/plugin_ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commandline/plugin_rm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion hack/vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions integration-cli/docker_cli_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions plugin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions plugin/manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -156,16 +156,16 @@ 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 {
if err := p.restartManager.Cancel(); err != nil {
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 {
Expand Down
9 changes: 5 additions & 4 deletions vendor/src/github.com/docker/engine-api/types/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit cf4e268

Please sign in to comment.