Skip to content

Commit

Permalink
Remove opts.QuotedString implementation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tianon committed Feb 16, 2022
1 parent c94596a commit c79a169
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 86 deletions.
12 changes: 4 additions & 8 deletions cmd/dockerd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,11 @@ func (o *daemonOptions) InstallFlags(flags *pflag.FlagSet) {

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

o.TLSOptions = &tlsconfig.Options{
CAFile: filepath.Join(dockerCertPath, DefaultCaFile),
CertFile: filepath.Join(dockerCertPath, DefaultCertFile),
KeyFile: filepath.Join(dockerCertPath, DefaultKeyFile),
}
o.TLSOptions = &tlsconfig.Options{}
tlsOptions := o.TLSOptions
flags.Var(opts.NewQuotedString(&tlsOptions.CAFile), "tlscacert", "Trust certs signed only by this CA")
flags.Var(opts.NewQuotedString(&tlsOptions.CertFile), "tlscert", "Path to TLS certificate file")
flags.Var(opts.NewQuotedString(&tlsOptions.KeyFile), "tlskey", "Path to TLS key file")
flags.StringVar(&tlsOptions.CAFile, "tlscacert", filepath.Join(dockerCertPath, DefaultCaFile), "Trust certs signed only by this CA")
flags.StringVar(&tlsOptions.CertFile, "tlscert", filepath.Join(dockerCertPath, DefaultCertFile), "Path to TLS certificate file")
flags.StringVar(&tlsOptions.KeyFile, "tlskey", filepath.Join(dockerCertPath, DefaultKeyFile), "Path to TLS key file")

hostOpt := opts.NewNamedListOptsRef("hosts", &o.Hosts, opts.ValidateHost)
flags.VarP(hostOpt, "host", "H", "Daemon socket(s) to connect to")
Expand Down
6 changes: 3 additions & 3 deletions cmd/dockerd/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ func TestCommonOptionsInstallFlags(t *testing.T) {
opts.InstallFlags(flags)

err := flags.Parse([]string{
"--tlscacert=\"/foo/cafile\"",
"--tlscert=\"/foo/cert\"",
"--tlskey=\"/foo/key\"",
"--tlscacert=/foo/cafile",
"--tlscert=/foo/cert",
"--tlskey=/foo/key",
})
assert.Check(t, err)
assert.Check(t, is.Equal("/foo/cafile", opts.TLSOptions.CAFile))
Expand Down
41 changes: 0 additions & 41 deletions opts/quotedstring.go

This file was deleted.

34 changes: 0 additions & 34 deletions opts/quotedstring_test.go

This file was deleted.

0 comments on commit c79a169

Please sign in to comment.