None of the daemon flags use a constant for the
flag name.
This patch removes the constant for consistency
Also removes a FIXME, that was now in the wrong
location, and added a long time ago in
353b7c8ec77b30fa83dac5ec0778193f6de8b437,
without a lot of context (and probably no longer really relevant).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -27,7 +27,6 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) {
|
| 27 | 27 |
flags.StringVarP(&conf.GraphDriver, "storage-driver", "s", "", "Storage driver to use") |
| 28 | 28 |
flags.IntVar(&conf.Mtu, "mtu", 0, "Set the containers network MTU") |
| 29 | 29 |
flags.BoolVar(&conf.RawLogs, "raw-logs", false, "Full timestamps without ANSI coloring") |
| 30 |
- // FIXME: why the inconsistency between "hosts" and "sockets"? |
|
| 31 | 30 |
flags.Var(opts.NewListOptsRef(&conf.DNS, opts.ValidateIPAddress), "dns", "DNS server to use") |
| 32 | 31 |
flags.Var(opts.NewNamedListOptsRef("dns-opts", &conf.DNSOptions, nil), "dns-opt", "DNS options to use")
|
| 33 | 32 |
flags.Var(opts.NewListOptsRef(&conf.DNSSearch, opts.ValidateDNSSearch), "dns-search", "DNS search domains to use") |
| ... | ... |
@@ -50,10 +50,6 @@ import ( |
| 50 | 50 |
"github.com/spf13/pflag" |
| 51 | 51 |
) |
| 52 | 52 |
|
| 53 |
-const ( |
|
| 54 |
- flagDaemonConfigFile = "config-file" |
|
| 55 |
-) |
|
| 56 |
- |
|
| 57 | 53 |
// DaemonCli represents the daemon CLI. |
| 58 | 54 |
type DaemonCli struct {
|
| 59 | 55 |
*config.Config |
| ... | ... |
@@ -426,7 +422,7 @@ func loadDaemonCliConfig(opts daemonOptions) (*config.Config, error) {
|
| 426 | 426 |
if opts.configFile != "" {
|
| 427 | 427 |
c, err := config.MergeDaemonConfigurations(conf, flags, opts.configFile) |
| 428 | 428 |
if err != nil {
|
| 429 |
- if flags.Changed(flagDaemonConfigFile) || !os.IsNotExist(err) {
|
|
| 429 |
+ if flags.Changed("config-file") || !os.IsNotExist(err) {
|
|
| 430 | 430 |
return nil, fmt.Errorf("unable to configure the Docker daemon with file %s: %v\n", opts.configFile, err)
|
| 431 | 431 |
} |
| 432 | 432 |
} |
| ... | ... |
@@ -19,7 +19,7 @@ func defaultOptions(configFile string) daemonOptions {
|
| 19 | 19 |
} |
| 20 | 20 |
opts.common.InstallFlags(opts.flags) |
| 21 | 21 |
installConfigFlags(opts.daemonConfig, opts.flags) |
| 22 |
- opts.flags.StringVar(&opts.configFile, flagDaemonConfigFile, defaultDaemonConfigFile, "") |
|
| 22 |
+ opts.flags.StringVar(&opts.configFile, "config-file", defaultDaemonConfigFile, "") |
|
| 23 | 23 |
opts.configFile = configFile |
| 24 | 24 |
return opts |
| 25 | 25 |
} |
| ... | ... |
@@ -55,7 +55,7 @@ func TestLoadDaemonCliConfigWithConflicts(t *testing.T) {
|
| 55 | 55 |
opts := defaultOptions(configFile) |
| 56 | 56 |
flags := opts.flags |
| 57 | 57 |
|
| 58 |
- assert.NilError(t, flags.Set(flagDaemonConfigFile, configFile)) |
|
| 58 |
+ assert.NilError(t, flags.Set("config-file", configFile))
|
|
| 59 | 59 |
assert.NilError(t, flags.Set("label", "l1=bar"))
|
| 60 | 60 |
assert.NilError(t, flags.Set("label", "l2=baz"))
|
| 61 | 61 |
|
| ... | ... |
@@ -46,7 +46,7 @@ func newDaemonCommand() *cobra.Command {
|
| 46 | 46 |
|
| 47 | 47 |
flags := cmd.Flags() |
| 48 | 48 |
flags.BoolVarP(&opts.version, "version", "v", false, "Print version information and quit") |
| 49 |
- flags.StringVar(&opts.configFile, flagDaemonConfigFile, defaultDaemonConfigFile, "Daemon configuration file") |
|
| 49 |
+ flags.StringVar(&opts.configFile, "config-file", defaultDaemonConfigFile, "Daemon configuration file") |
|
| 50 | 50 |
opts.common.InstallFlags(flags) |
| 51 | 51 |
installConfigFlags(opts.daemonConfig, flags) |
| 52 | 52 |
installServiceFlags(flags) |