mirror of https://github.com/docker/cli.git
Suppressing digest for docker service ls/ps
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
parent
91aed2e673
commit
5f1209bf4b
|
@ -5,6 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
distreference "github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
|
@ -127,6 +128,16 @@ func printTable(out io.Writer, services []swarm.Service, running, tasksNoShutdow
|
||||||
mode = "global"
|
mode = "global"
|
||||||
replicas = fmt.Sprintf("%d/%d", running[service.ID], tasksNoShutdown[service.ID])
|
replicas = fmt.Sprintf("%d/%d", running[service.ID], tasksNoShutdown[service.ID])
|
||||||
}
|
}
|
||||||
|
image := service.Spec.TaskTemplate.ContainerSpec.Image
|
||||||
|
ref, err := distreference.ParseNamed(image)
|
||||||
|
if err == nil {
|
||||||
|
// update image string for display
|
||||||
|
namedTagged, ok := ref.(distreference.NamedTagged)
|
||||||
|
if ok {
|
||||||
|
image = namedTagged.Name() + ":" + namedTagged.Tag()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
writer,
|
writer,
|
||||||
listItemFmt,
|
listItemFmt,
|
||||||
|
@ -134,7 +145,7 @@ func printTable(out io.Writer, services []swarm.Service, running, tasksNoShutdow
|
||||||
service.Spec.Name,
|
service.Spec.Name,
|
||||||
mode,
|
mode,
|
||||||
replicas,
|
replicas,
|
||||||
service.Spec.TaskTemplate.ContainerSpec.Image)
|
image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
distreference "github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/cli/command"
|
"github.com/docker/docker/cli/command"
|
||||||
"github.com/docker/docker/cli/command/idresolver"
|
"github.com/docker/docker/cli/command/idresolver"
|
||||||
|
@ -118,11 +119,23 @@ func print(out io.Writer, ctx context.Context, tasks []swarm.Task, resolver *idr
|
||||||
taskErr = fmt.Sprintf("\"%s\"", taskErr)
|
taskErr = fmt.Sprintf("\"%s\"", taskErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image := task.Spec.ContainerSpec.Image
|
||||||
|
if !noTrunc {
|
||||||
|
ref, err := distreference.ParseNamed(image)
|
||||||
|
if err == nil {
|
||||||
|
// update image string for display
|
||||||
|
namedTagged, ok := ref.(distreference.NamedTagged)
|
||||||
|
if ok {
|
||||||
|
image = namedTagged.Name() + ":" + namedTagged.Tag()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
out,
|
out,
|
||||||
psTaskItemFmt,
|
psTaskItemFmt,
|
||||||
indentedName,
|
indentedName,
|
||||||
task.Spec.ContainerSpec.Image,
|
image,
|
||||||
nodeValue,
|
nodeValue,
|
||||||
command.PrettyPrint(task.DesiredState),
|
command.PrettyPrint(task.DesiredState),
|
||||||
command.PrettyPrint(task.Status.State),
|
command.PrettyPrint(task.Status.State),
|
||||||
|
|
Loading…
Reference in New Issue