make DriverOpts name consistent.

Signed-off-by: Tino Rusch <tino.rusch@gmail.com>
This commit is contained in:
Tino Rusch
2021-06-25 08:33:15 +02:00
parent b56b4b5374
commit e7507fe7cf
5 changed files with 12 additions and 12 deletions

View File

@ -47,7 +47,7 @@ func init() {
cfg := registry.PodmanConfig()
flags.StringVar(&createOpts.Driver, driverFlagName, cfg.Secrets.Driver, "Specify secret driver")
flags.StringToStringVar(&createOpts.Opts, optsFlagName, cfg.Secrets.Opts, "Specify driver specific options")
flags.StringToStringVar(&createOpts.DriverOpts, optsFlagName, cfg.Secrets.Opts, "Specify driver specific options")
_ = createCmd.RegisterFlagCompletionFunc(driverFlagName, completion.AutocompleteNone)
_ = createCmd.RegisterFlagCompletionFunc(optsFlagName, completion.AutocompleteNone)

View File

@ -40,7 +40,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
}
opts.Driver = query.Driver
opts.Opts = query.DriverOpts
opts.DriverOpts = query.DriverOpts
ic := abi.ContainerEngine{Libpod: runtime}
report, err := ic.SecretCreate(r.Context(), query.Name, r.Body, opts)

View File

@ -11,8 +11,8 @@ type SecretCreateReport struct {
}
type SecretCreateOptions struct {
Driver string
Opts map[string]string
Driver string
DriverOpts map[string]string
}
type SecretListRequest struct {

View File

@ -27,20 +27,20 @@ func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader
if options.Driver == "" {
options.Driver = cfg.Secrets.Driver
}
if len(options.Opts) == 0 {
options.Opts = cfg.Secrets.Opts
if len(options.DriverOpts) == 0 {
options.DriverOpts = cfg.Secrets.Opts
}
if options.Opts == nil {
options.Opts = make(map[string]string)
if options.DriverOpts == nil {
options.DriverOpts = make(map[string]string)
}
if options.Driver == "file" {
if _, ok := options.Opts["path"]; !ok {
options.Opts["path"] = filepath.Join(secretsPath, "filedriver")
if _, ok := options.DriverOpts["path"]; !ok {
options.DriverOpts["path"] = filepath.Join(secretsPath, "filedriver")
}
}
secretID, err := manager.Store(name, data, options.Driver, options.Opts)
secretID, err := manager.Store(name, data, options.Driver, options.DriverOpts)
if err != nil {
return nil, err
}

View File

@ -13,7 +13,7 @@ import (
func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) {
opts := new(secrets.CreateOptions).
WithDriver(options.Driver).
WithDriverOpts(options.Opts).
WithDriverOpts(options.DriverOpts).
WithName(name)
created, err := secrets.Create(ic.ClientCtx, reader, opts)
if err != nil {