mirror of https://github.com/docker/cli.git
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:
commit
5ad1cebf78
|
@ -10,8 +10,9 @@ import (
|
|||
)
|
||||
|
||||
type inspectOptions struct {
|
||||
format string
|
||||
names []string
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue