commands: implementation for inspect

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2019-04-15 10:21:09 -07:00
parent bd3d5cd19e
commit b7e15f3113
5 changed files with 189 additions and 23 deletions

View File

@ -153,7 +153,7 @@ func (d *Driver) Info(ctx context.Context) (*driver.Info, error) {
if err != nil {
if dockerclient.IsErrNotFound(err) {
return &driver.Info{
Status: driver.Terminated,
Status: driver.Inactive,
}, nil
}
return nil, err
@ -186,7 +186,7 @@ func (d *Driver) Rm(ctx context.Context, force bool) error {
if err != nil {
return err
}
if info.Status != driver.Terminated {
if info.Status != driver.Inactive {
return d.DockerAPI.ContainerRemove(ctx, d.Name, dockertypes.ContainerRemoveOptions{
RemoveVolumes: true,
Force: true,

View File

@ -10,18 +10,34 @@ import (
)
var ErrNotRunning = errors.Errorf("driver not running")
var ErrNotConnecting = errors.Errorf("driver not connection")
var ErrNotConnecting = errors.Errorf("driver not connecting")
type Status int
const (
Terminated Status = iota
Inactive Status = iota
Starting
Running
Stopping
Stopped
)
func (s Status) String() string {
switch s {
case Inactive:
return "inactive"
case Starting:
return "starting"
case Running:
return "running"
case Stopping:
return "stopping"
case Stopped:
return "stopped"
}
return "unknown"
}
type Info struct {
Status Status
}