Merge pull request #43990 from thaJeztah/22.06_backport_deprecate_graph
[22.06 backport] daemon: complete the "--graph" / "-g" deprecation
This commit is contained in:
commit
8e9684c029
3 changed files with 9 additions and 22 deletions
|
@ -79,10 +79,9 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
|||
|
||||
// Deprecated flags / options
|
||||
|
||||
// "--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.StringVarP(&conf.Root, "graph", "g", conf.Root, "Root of the Docker runtime")
|
||||
_ = flags.MarkHidden("graph")
|
||||
//nolint:staticcheck // TODO(thaJeztah): remove in next release.
|
||||
flags.StringVarP(&conf.RootDeprecated, "graph", "g", conf.RootDeprecated, "Root of the Docker runtime")
|
||||
_ = flags.MarkDeprecated("graph", "Use --data-root instead")
|
||||
flags.BoolVarP(&conf.AutoRestart, "restart", "r", true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
|
||||
_ = flags.MarkDeprecated("restart", "Please use a restart policy on docker run")
|
||||
flags.StringVar(&conf.ClusterAdvertise, "cluster-advertise", "", "Address or interface name to advertise")
|
||||
|
|
|
@ -395,9 +395,6 @@ func loadDaemonCliConfig(opts *daemonOptions) (*config.Config, error) {
|
|||
conf.Hosts = opts.Hosts
|
||||
conf.LogLevel = opts.LogLevel
|
||||
|
||||
if flags.Changed("graph") && flags.Changed("data-root") {
|
||||
return nil, errors.New(`cannot specify both "--graph" and "--data-root" option`)
|
||||
}
|
||||
if flags.Changed(FlagTLS) {
|
||||
conf.TLS = &opts.TLS
|
||||
}
|
||||
|
@ -448,10 +445,6 @@ 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`)
|
||||
}
|
||||
|
||||
// Check if duplicate label-keys with different values are found
|
||||
newLabels, err := config.GetConflictFreeLabels(conf.Labels)
|
||||
if err != nil {
|
||||
|
|
|
@ -157,7 +157,7 @@ type CommonConfig struct {
|
|||
NetworkDiagnosticPort int `json:"network-diagnostic-port,omitempty"`
|
||||
Pidfile string `json:"pidfile,omitempty"`
|
||||
RawLogs bool `json:"raw-logs,omitempty"`
|
||||
RootDeprecated string `json:"graph,omitempty"`
|
||||
RootDeprecated string `json:"graph,omitempty"` // Deprecated: use Root instead. TODO(thaJeztah): remove in next release.
|
||||
Root string `json:"data-root,omitempty"`
|
||||
ExecRoot string `json:"exec-root,omitempty"`
|
||||
SocketGroup string `json:"group,omitempty"`
|
||||
|
@ -479,16 +479,6 @@ func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Con
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if config.RootDeprecated != "" {
|
||||
logrus.Warn(`The "graph" config file option is deprecated. Please use "data-root" instead.`)
|
||||
|
||||
if config.Root != "" {
|
||||
return nil, errors.New(`cannot specify both "graph" and "data-root" config file options`)
|
||||
}
|
||||
|
||||
config.Root = config.RootDeprecated
|
||||
}
|
||||
|
||||
return &config, nil
|
||||
}
|
||||
|
||||
|
@ -579,6 +569,11 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
|
|||
// such as config.DNS, config.Labels, config.DNSSearch,
|
||||
// as well as config.MaxConcurrentDownloads, config.MaxConcurrentUploads and config.MaxDownloadAttempts.
|
||||
func Validate(config *Config) error {
|
||||
//nolint:staticcheck // TODO(thaJeztah): remove in next release.
|
||||
if config.RootDeprecated != "" {
|
||||
return errors.New(`the "graph" config file option is deprecated; use "data-root" instead`)
|
||||
}
|
||||
|
||||
// validate log-level
|
||||
if config.LogLevel != "" {
|
||||
if _, err := logrus.ParseLevel(config.LogLevel); err != nil {
|
||||
|
|
Loading…
Reference in a new issue