Skip to content

Commit c79a169

Browse files
committed
Remove opts.QuotedString implementation
This was originally added to solve a CLI usability issue related to `docker-machine` and `docker` (explicitly *not* `dockerd`) -- the "docker/cli" repository has a separate copy of this entire `opts` package, so isn't even using this implementation. Signed-off-by: Tianon Gravi <[email protected]>
1 parent c94596a commit c79a169

4 files changed

Lines changed: 7 additions & 86 deletions

File tree

cmd/dockerd/options.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,11 @@ func (o *daemonOptions) InstallFlags(flags *pflag.FlagSet) {
6767

6868
// TODO use flag flags.String("identity"}, "i", "", "Path to libtrust key file")
6969

70-
o.TLSOptions = &tlsconfig.Options{
71-
CAFile: filepath.Join(dockerCertPath, DefaultCaFile),
72-
CertFile: filepath.Join(dockerCertPath, DefaultCertFile),
73-
KeyFile: filepath.Join(dockerCertPath, DefaultKeyFile),
74-
}
70+
o.TLSOptions = &tlsconfig.Options{}
7571
tlsOptions := o.TLSOptions
76-
flags.Var(opts.NewQuotedString(&tlsOptions.CAFile), "tlscacert", "Trust certs signed only by this CA")
77-
flags.Var(opts.NewQuotedString(&tlsOptions.CertFile), "tlscert", "Path to TLS certificate file")
78-
flags.Var(opts.NewQuotedString(&tlsOptions.KeyFile), "tlskey", "Path to TLS key file")
72+
flags.StringVar(&tlsOptions.CAFile, "tlscacert", filepath.Join(dockerCertPath, DefaultCaFile), "Trust certs signed only by this CA")
73+
flags.StringVar(&tlsOptions.CertFile, "tlscert", filepath.Join(dockerCertPath, DefaultCertFile), "Path to TLS certificate file")
74+
flags.StringVar(&tlsOptions.KeyFile, "tlskey", filepath.Join(dockerCertPath, DefaultKeyFile), "Path to TLS key file")
7975

8076
hostOpt := opts.NewNamedListOptsRef("hosts", &o.Hosts, opts.ValidateHost)
8177
flags.VarP(hostOpt, "host", "H", "Daemon socket(s) to connect to")

cmd/dockerd/options_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ func TestCommonOptionsInstallFlags(t *testing.T) {
1717
opts.InstallFlags(flags)
1818

1919
err := flags.Parse([]string{
20-
"--tlscacert=\"/foo/cafile\"",
21-
"--tlscert=\"/foo/cert\"",
22-
"--tlskey=\"/foo/key\"",
20+
"--tlscacert=/foo/cafile",
21+
"--tlscert=/foo/cert",
22+
"--tlskey=/foo/key",
2323
})
2424
assert.Check(t, err)
2525
assert.Check(t, is.Equal("/foo/cafile", opts.TLSOptions.CAFile))

opts/quotedstring.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

opts/quotedstring_test.go

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)