mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add conflict check for flags, and update deprecation versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
261ef1fa27
commit
df7a72cffa
3 changed files with 17 additions and 4 deletions
|
@ -22,7 +22,11 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
|||
flags.Var(opts.NewNamedListOptsRef("exec-opts", &conf.ExecOptions, nil), "exec-opt", "Runtime execution options")
|
||||
flags.StringVarP(&conf.Pidfile, "pidfile", "p", defaultPidFile, "Path to use for daemon PID file")
|
||||
flags.StringVarP(&conf.Root, "graph", "g", defaultDataRoot, "Root of the Docker runtime")
|
||||
flags.MarkDeprecated("graph", "Please use --data-root instead")
|
||||
|
||||
// "--graph" is "soft-deprecated" in favor of "data-root". This flag was added
|
||||
// before Docker 1.0, so won't be removed, only hidden, to discourage its usage.
|
||||
flags.MarkHidden("graph")
|
||||
|
||||
flags.StringVar(&conf.Root, "data-root", defaultDataRoot, "Root directory of persistent Docker state")
|
||||
|
||||
flags.BoolVarP(&conf.AutoRestart, "restart", "r", true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
|
||||
|
|
|
@ -423,6 +423,10 @@ func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) {
|
|||
conf.CommonTLSOptions.KeyFile = opts.common.TLSOptions.KeyFile
|
||||
}
|
||||
|
||||
if flags.Changed("graph") && flags.Changed("data-root") {
|
||||
return nil, fmt.Errorf(`cannot specify both "--graph" and "--data-root" option`)
|
||||
}
|
||||
|
||||
if opts.configFile != "" {
|
||||
c, err := config.MergeDaemonConfigurations(conf, flags, opts.configFile)
|
||||
if err != nil {
|
||||
|
@ -441,6 +445,10 @@ func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if flags.Changed("graph") {
|
||||
logrus.Warnf(`the "-g / --graph" flag is deprecated. Please use "--data-root" instead`)
|
||||
}
|
||||
|
||||
// Labels of the docker engine used to allow multiple values associated with the same key.
|
||||
// This is deprecated in 1.13, and, be removed after 3 release cycles.
|
||||
// The following will check the conflict of labels, and report a warning for deprecation.
|
||||
|
|
|
@ -22,15 +22,16 @@ see [Feature Deprecation Policy](https://docs.docker.com/engine/#feature-depreca
|
|||
|
||||
### `-g` and `--graph` flags on `dockerd`
|
||||
|
||||
**Deprecated In Release: v1.14.0**
|
||||
|
||||
**Target For Removal In Release: v1.17**
|
||||
**Deprecated In Release: v17.05.0**
|
||||
|
||||
The `-g` or `--graph` flag for the `dockerd` or `docker daemon` command was
|
||||
used to indicate the directory in which to store persistent data and resource
|
||||
configuration and has been replaced with the more descriptive `--data-root`
|
||||
flag.
|
||||
|
||||
These flags were added before Docker 1.0, so will not be _removed_, only
|
||||
_hidden_, to discourage their use.
|
||||
|
||||
### Top-level network properties in NetworkSettings
|
||||
|
||||
**Deprecated In Release: [v1.13.0](https://github.com/docker/docker/releases/tag/v1.13.0)**
|
||||
|
|
Loading…
Reference in a new issue