浏览代码

fix the type

Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
yupengzte 8 年之前
父节点
当前提交
d735972d31

+ 2 - 2
cli/command/node/update.go

@@ -31,8 +31,8 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
 	}
 	}
 
 
 	flags := cmd.Flags()
 	flags := cmd.Flags()
-	flags.StringVar(&nodeOpts.role, flagRole, "", "Role of the node (worker/manager)")
-	flags.StringVar(&nodeOpts.availability, flagAvailability, "", "Availability of the node (active/pause/drain)")
+	flags.StringVar(&nodeOpts.role, flagRole, "", `Role of the node ("worker"|"manager")`)
+	flags.StringVar(&nodeOpts.availability, flagAvailability, "", `Availability of the node ("active"|"pause"|"drain")`)
 	flags.Var(&nodeOpts.annotations.labels, flagLabelAdd, "Add or update a node label (key=value)")
 	flags.Var(&nodeOpts.annotations.labels, flagLabelAdd, "Add or update a node label (key=value)")
 	labelKeys := opts.NewListOpts(nil)
 	labelKeys := opts.NewListOpts(nil)
 	flags.Var(&labelKeys, flagLabelRemove, "Remove a node label if exists")
 	flags.Var(&labelKeys, flagLabelRemove, "Remove a node label if exists")

+ 2 - 2
cli/command/service/opts.go

@@ -446,7 +446,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
 
 
 	flags.Var(&opts.replicas, flagReplicas, "Number of tasks")
 	flags.Var(&opts.replicas, flagReplicas, "Number of tasks")
 
 
-	flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", "Restart when condition is met (none, on-failure, or any)")
+	flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", `Restart when condition is met ("none"|"on-failure"|"any")`)
 	flags.Var(&opts.restartPolicy.delay, flagRestartDelay, "Delay between restart attempts (ns|us|ms|s|m|h)")
 	flags.Var(&opts.restartPolicy.delay, flagRestartDelay, "Delay between restart attempts (ns|us|ms|s|m|h)")
 	flags.Var(&opts.restartPolicy.maxAttempts, flagRestartMaxAttempts, "Maximum number of restarts before giving up")
 	flags.Var(&opts.restartPolicy.maxAttempts, flagRestartMaxAttempts, "Maximum number of restarts before giving up")
 	flags.Var(&opts.restartPolicy.window, flagRestartWindow, "Window used to evaluate the restart policy (ns|us|ms|s|m|h)")
 	flags.Var(&opts.restartPolicy.window, flagRestartWindow, "Window used to evaluate the restart policy (ns|us|ms|s|m|h)")
@@ -455,7 +455,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
 	flags.DurationVar(&opts.update.delay, flagUpdateDelay, time.Duration(0), "Delay between updates (ns|us|ms|s|m|h) (default 0s)")
 	flags.DurationVar(&opts.update.delay, flagUpdateDelay, time.Duration(0), "Delay between updates (ns|us|ms|s|m|h) (default 0s)")
 	flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, time.Duration(0), "Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)")
 	flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, time.Duration(0), "Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)")
 	flags.SetAnnotation(flagUpdateMonitor, "version", []string{"1.25"})
 	flags.SetAnnotation(flagUpdateMonitor, "version", []string{"1.25"})
-	flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "pause", "Action on update failure (pause|continue)")
+	flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "pause", `Action on update failure ("pause"|"continue")`)
 	flags.Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, "Failure rate to tolerate during an update")
 	flags.Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, "Failure rate to tolerate during an update")
 	flags.SetAnnotation(flagUpdateMaxFailureRatio, "version", []string{"1.25"})
 	flags.SetAnnotation(flagUpdateMaxFailureRatio, "version", []string{"1.25"})
 
 

+ 1 - 1
cli/command/swarm/init.go

@@ -42,7 +42,7 @@ func newInitCommand(dockerCli command.Cli) *cobra.Command {
 	flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: <ip|interface>[:port])")
 	flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: <ip|interface>[:port])")
 	flags.BoolVar(&opts.forceNewCluster, "force-new-cluster", false, "Force create a new cluster from current state")
 	flags.BoolVar(&opts.forceNewCluster, "force-new-cluster", false, "Force create a new cluster from current state")
 	flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable manager autolocking (requiring an unlock key to start a stopped manager)")
 	flags.BoolVar(&opts.autolock, flagAutolock, false, "Enable manager autolocking (requiring an unlock key to start a stopped manager)")
-	flags.StringVar(&opts.availability, flagAvailability, "active", "Availability of the node (active/pause/drain)")
+	flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active"|"pause"|"drain")`)
 	addSwarmFlags(flags, &opts.swarmOptions)
 	addSwarmFlags(flags, &opts.swarmOptions)
 	return cmd
 	return cmd
 }
 }

+ 1 - 1
cli/command/swarm/join.go

@@ -41,7 +41,7 @@ func newJoinCommand(dockerCli command.Cli) *cobra.Command {
 	flags.Var(&opts.listenAddr, flagListenAddr, "Listen address (format: <ip|interface>[:port])")
 	flags.Var(&opts.listenAddr, flagListenAddr, "Listen address (format: <ip|interface>[:port])")
 	flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: <ip|interface>[:port])")
 	flags.StringVar(&opts.advertiseAddr, flagAdvertiseAddr, "", "Advertised address (format: <ip|interface>[:port])")
 	flags.StringVar(&opts.token, flagToken, "", "Token for entry into the swarm")
 	flags.StringVar(&opts.token, flagToken, "", "Token for entry into the swarm")
-	flags.StringVar(&opts.availability, flagAvailability, "active", "Availability of the node (active/pause/drain)")
+	flags.StringVar(&opts.availability, flagAvailability, "active", `Availability of the node ("active"|"pause"|"drain")`)
 	return cmd
 	return cmd
 }
 }
 
 

+ 1 - 1
cli/flags/common.go

@@ -53,7 +53,7 @@ func (commonOpts *CommonOptions) InstallFlags(flags *pflag.FlagSet) {
 	}
 	}
 
 
 	flags.BoolVarP(&commonOpts.Debug, "debug", "D", false, "Enable debug mode")
 	flags.BoolVarP(&commonOpts.Debug, "debug", "D", false, "Enable debug mode")
-	flags.StringVarP(&commonOpts.LogLevel, "log-level", "l", "info", "Set the logging level (\"debug\", \"info\", \"warn\", \"error\", \"fatal\")")
+	flags.StringVarP(&commonOpts.LogLevel, "log-level", "l", "info", `Set the logging level ("debug"|"info"|"warn"|"error"|"fatal")`)
 	flags.BoolVar(&commonOpts.TLS, "tls", false, "Use TLS; implied by --tlsverify")
 	flags.BoolVar(&commonOpts.TLS, "tls", false, "Use TLS; implied by --tlsverify")
 	flags.BoolVar(&commonOpts.TLSVerify, FlagTLSVerify, dockerTLSVerify, "Use TLS and verify the remote")
 	flags.BoolVar(&commonOpts.TLSVerify, FlagTLSVerify, dockerTLSVerify, "Use TLS and verify the remote")
 
 

+ 2 - 2
docs/api/v1.24.md

@@ -4144,8 +4144,8 @@ JSON Parameters:
     - **Name** – User-defined name for the node.
     - **Name** – User-defined name for the node.
     - **Labels** – A map of labels to associate with the node (e.g.,
     - **Labels** – A map of labels to associate with the node (e.g.,
       `{"key":"value", "key2":"value2"}`).
       `{"key":"value", "key2":"value2"}`).
-- **Role** - Role of the node (worker/manager).
-- **Availability** - Availability of the node (active/pause/drain).
+- **Role** - Role of the node (worker|manager).
+- **Availability** - Availability of the node (active|pause|drain).
 
 
 
 
 **Status codes**:
 **Status codes**:

+ 1 - 1
docs/reference/commandline/cli.md

@@ -30,7 +30,7 @@ Options:
   -D, --debug              Enable debug mode
   -D, --debug              Enable debug mode
       --help               Print usage
       --help               Print usage
   -H, --host value         Daemon socket(s) to connect to (default [])
   -H, --host value         Daemon socket(s) to connect to (default [])
-  -l, --log-level string   Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
+  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
       --tls                Use TLS; implied by --tlsverify
       --tls                Use TLS; implied by --tlsverify
       --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
       --tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")
       --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
       --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")

+ 1 - 1
docs/reference/commandline/dockerd.md

@@ -64,7 +64,7 @@ Options:
       --label value                           Set key=value labels to the daemon (default [])
       --label value                           Set key=value labels to the daemon (default [])
       --live-restore                          Enable live restore of docker when containers are still running (Linux only)
       --live-restore                          Enable live restore of docker when containers are still running (Linux only)
       --log-driver string                     Default driver for container logs (default "json-file")
       --log-driver string                     Default driver for container logs (default "json-file")
-  -l, --log-level string                      Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
+  -l, --log-level string                      Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
       --log-opt value                         Default log driver options for containers (default map[])
       --log-opt value                         Default log driver options for containers (default map[])
       --max-concurrent-downloads int          Set the max concurrent downloads for each pull (default 3)
       --max-concurrent-downloads int          Set the max concurrent downloads for each pull (default 3)
       --max-concurrent-uploads int            Set the max concurrent uploads for each push (default 5)
       --max-concurrent-uploads int            Set the max concurrent uploads for each push (default 5)

+ 2 - 2
docs/reference/commandline/node_update.md

@@ -21,11 +21,11 @@ Usage:  docker node update [OPTIONS] NODE
 Update a node
 Update a node
 
 
 Options:
 Options:
-      --availability string   Availability of the node (active/pause/drain)
+      --availability string   Availability of the node ("active"|"pause"|"drain")
       --help                  Print usage
       --help                  Print usage
       --label-add value       Add or update a node label (key=value) (default [])
       --label-add value       Add or update a node label (key=value) (default [])
       --label-rm value        Remove a node label if exists (default [])
       --label-rm value        Remove a node label if exists (default [])
-      --role string           Role of the node (worker/manager)
+      --role string           Role of the node ("worker"|"manager")
 ```
 ```
 
 
 ### Add label metadata to a node
 ### Add label metadata to a node

+ 3 - 3
docs/reference/commandline/service_create.md

@@ -26,7 +26,7 @@ Options:
       --dns list                         Set custom DNS servers (default [])
       --dns list                         Set custom DNS servers (default [])
       --dns-option list                  Set DNS options (default [])
       --dns-option list                  Set DNS options (default [])
       --dns-search list                  Set custom DNS search domains (default [])
       --dns-search list                  Set custom DNS search domains (default [])
-      --endpoint-mode string             Endpoint mode (vip or dnsrr) (default "vip")
+      --endpoint-mode string             Endpoint mode ("vip"|"dnsrr") (default "vip")
   -e, --env list                         Set environment variables (default [])
   -e, --env list                         Set environment variables (default [])
       --env-file list                    Read in a file of environment variables (default [])
       --env-file list                    Read in a file of environment variables (default [])
       --group list                       Set one or more supplementary user groups for the container (default [])
       --group list                       Set one or more supplementary user groups for the container (default [])
@@ -52,7 +52,7 @@ Options:
       --replicas uint                    Number of tasks
       --replicas uint                    Number of tasks
       --reserve-cpu decimal              Reserve CPUs (default 0.000)
       --reserve-cpu decimal              Reserve CPUs (default 0.000)
       --reserve-memory bytes             Reserve Memory
       --reserve-memory bytes             Reserve Memory
-      --restart-condition string         Restart when condition is met (none, on-failure, or any)
+      --restart-condition string         Restart when condition is met ("none"|"on-failure"|"any")
       --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
       --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
       --restart-max-attempts uint        Maximum number of restarts before giving up
       --restart-max-attempts uint        Maximum number of restarts before giving up
       --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
       --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
@@ -60,7 +60,7 @@ Options:
       --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
       --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
   -t, --tty                              Allocate a pseudo-TTY
   -t, --tty                              Allocate a pseudo-TTY
       --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
       --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
-      --update-failure-action string     Action on update failure (pause|continue) (default "pause")
+      --update-failure-action string     Action on update failure ("pause"|"continue") (default "pause")
       --update-max-failure-ratio float   Failure rate to tolerate during an update
       --update-max-failure-ratio float   Failure rate to tolerate during an update
       --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
       --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
       --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
       --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)

+ 3 - 3
docs/reference/commandline/service_update.md

@@ -32,7 +32,7 @@ Options:
       --dns-rm list                      Remove a custom DNS server (default [])
       --dns-rm list                      Remove a custom DNS server (default [])
       --dns-search-add list              Add or update a custom DNS search domain (default [])
       --dns-search-add list              Add or update a custom DNS search domain (default [])
       --dns-search-rm list               Remove a DNS search domain (default [])
       --dns-search-rm list               Remove a DNS search domain (default [])
-      --endpoint-mode string             Endpoint mode (vip or dnsrr) (default "vip")
+      --endpoint-mode string             Endpoint mode ("vip"|"dnsrr") (default "vip")
       --env-add list                     Add or update an environment variable (default [])
       --env-add list                     Add or update an environment variable (default [])
       --env-rm list                      Remove an environment variable (default [])
       --env-rm list                      Remove an environment variable (default [])
       --force                            Force update even if no changes require it
       --force                            Force update even if no changes require it
@@ -62,7 +62,7 @@ Options:
       --replicas uint                    Number of tasks
       --replicas uint                    Number of tasks
       --reserve-cpu decimal              Reserve CPUs (default 0.000)
       --reserve-cpu decimal              Reserve CPUs (default 0.000)
       --reserve-memory bytes             Reserve Memory
       --reserve-memory bytes             Reserve Memory
-      --restart-condition string         Restart when condition is met (none, on-failure, or any)
+      --restart-condition string         Restart when condition is met ("none"|"on-failure"|"any")
       --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
       --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
       --restart-max-attempts uint        Maximum number of restarts before giving up
       --restart-max-attempts uint        Maximum number of restarts before giving up
       --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
       --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
@@ -72,7 +72,7 @@ Options:
       --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
       --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
   -t, --tty                              Allocate a pseudo-TTY
   -t, --tty                              Allocate a pseudo-TTY
       --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
       --update-delay duration            Delay between updates (ns|us|ms|s|m|h) (default 0s)
-      --update-failure-action string     Action on update failure (pause|continue) (default "pause")
+      --update-failure-action string     Action on update failure ("pause"|"continue") (default "pause")
       --update-max-failure-ratio float   Failure rate to tolerate during an update
       --update-max-failure-ratio float   Failure rate to tolerate during an update
       --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
       --update-monitor duration          Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
       --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
       --update-parallelism uint          Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)

+ 1 - 1
docs/reference/commandline/swarm_init.md

@@ -23,7 +23,7 @@ Initialize a swarm
 Options:
 Options:
       --advertise-addr string           Advertised address (format: <ip|interface>[:port])
       --advertise-addr string           Advertised address (format: <ip|interface>[:port])
       --autolock                        Enable manager autolocking (requiring an unlock key to start a stopped manager)
       --autolock                        Enable manager autolocking (requiring an unlock key to start a stopped manager)
-      --availability string             Availability of the node (active/pause/drain) (default "active")
+      --availability string             Availability of the node ("active"|"pause"|"drain") (default "active")
       --cert-expiry duration            Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)
       --cert-expiry duration            Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)
       --dispatcher-heartbeat duration   Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)
       --dispatcher-heartbeat duration   Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)
       --external-ca external-ca         Specifications of one or more certificate signing endpoints
       --external-ca external-ca         Specifications of one or more certificate signing endpoints

+ 1 - 1
docs/reference/commandline/swarm_join.md

@@ -22,7 +22,7 @@ Join a swarm as a node and/or manager
 
 
 Options:
 Options:
       --advertise-addr string   Advertised address (format: <ip|interface>[:port])
       --advertise-addr string   Advertised address (format: <ip|interface>[:port])
-      --availability string     Availability of the node (active/pause/drain) (default "active")
+      --availability string     Availability of the node ("active"|"pause"|"drain") (default "active")
       --help                    Print usage
       --help                    Print usage
       --listen-addr node-addr   Listen address (format: <ip|interface>[:port]) (default 0.0.0.0:2377)
       --listen-addr node-addr   Listen address (format: <ip|interface>[:port]) (default 0.0.0.0:2377)
       --token string            Token for entry into the swarm
       --token string            Token for entry into the swarm