Merge pull request #31710 from sanimej/drillerrr

Add verbose flag to network inspect to show all services & tasks in swarm mode
This commit is contained in:
Madhu Venugopal 2017-03-13 21:12:32 -07:00 committed by GitHub
commit 5ad1cebf78
3 changed files with 7 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import (
type inspectOptions struct {
format string
names []string
verbose bool
}
func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
@ -28,6 +29,7 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
}
cmd.Flags().StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template")
cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "Verbose output for diagnostics")
return cmd
}
@ -38,7 +40,7 @@ func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
ctx := context.Background()
getNetFunc := func(name string) (interface{}, []byte, error) {
return client.NetworkInspectWithRaw(ctx, name)
return client.NetworkInspectWithRaw(ctx, name, opts.verbose)
}
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getNetFunc)

View File

@ -140,7 +140,7 @@ func validateExternalNetworks(
client := dockerCli.Client()
for _, networkName := range externalNetworks {
network, err := client.NetworkInspect(ctx, networkName)
network, err := client.NetworkInspect(ctx, networkName, false)
if err != nil {
if dockerclient.IsErrNetworkNotFound(err) {
return fmt.Errorf("network %q is declared as external, but could not be found. You need to create the network before the stack is deployed (with overlay driver)", networkName)

View File

@ -67,7 +67,7 @@ func inspectImages(ctx context.Context, dockerCli *command.DockerCli) inspect.Ge
func inspectNetwork(ctx context.Context, dockerCli *command.DockerCli) inspect.GetRefFunc {
return func(ref string) (interface{}, []byte, error) {
return dockerCli.Client().NetworkInspectWithRaw(ctx, ref)
return dockerCli.Client().NetworkInspectWithRaw(ctx, ref, false)
}
}