mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
make DriverOpts name consistent.
Signed-off-by: Tino Rusch <tino.rusch@gmail.com>
This commit is contained in:
@ -47,7 +47,7 @@ func init() {
|
|||||||
cfg := registry.PodmanConfig()
|
cfg := registry.PodmanConfig()
|
||||||
|
|
||||||
flags.StringVar(&createOpts.Driver, driverFlagName, cfg.Secrets.Driver, "Specify secret driver")
|
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(driverFlagName, completion.AutocompleteNone)
|
||||||
_ = createCmd.RegisterFlagCompletionFunc(optsFlagName, completion.AutocompleteNone)
|
_ = createCmd.RegisterFlagCompletionFunc(optsFlagName, completion.AutocompleteNone)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts.Driver = query.Driver
|
opts.Driver = query.Driver
|
||||||
opts.Opts = query.DriverOpts
|
opts.DriverOpts = query.DriverOpts
|
||||||
|
|
||||||
ic := abi.ContainerEngine{Libpod: runtime}
|
ic := abi.ContainerEngine{Libpod: runtime}
|
||||||
report, err := ic.SecretCreate(r.Context(), query.Name, r.Body, opts)
|
report, err := ic.SecretCreate(r.Context(), query.Name, r.Body, opts)
|
||||||
|
@ -12,7 +12,7 @@ type SecretCreateReport struct {
|
|||||||
|
|
||||||
type SecretCreateOptions struct {
|
type SecretCreateOptions struct {
|
||||||
Driver string
|
Driver string
|
||||||
Opts map[string]string
|
DriverOpts map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecretListRequest struct {
|
type SecretListRequest struct {
|
||||||
|
@ -27,20 +27,20 @@ func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader
|
|||||||
if options.Driver == "" {
|
if options.Driver == "" {
|
||||||
options.Driver = cfg.Secrets.Driver
|
options.Driver = cfg.Secrets.Driver
|
||||||
}
|
}
|
||||||
if len(options.Opts) == 0 {
|
if len(options.DriverOpts) == 0 {
|
||||||
options.Opts = cfg.Secrets.Opts
|
options.DriverOpts = cfg.Secrets.Opts
|
||||||
}
|
}
|
||||||
if options.Opts == nil {
|
if options.DriverOpts == nil {
|
||||||
options.Opts = make(map[string]string)
|
options.DriverOpts = make(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Driver == "file" {
|
if options.Driver == "file" {
|
||||||
if _, ok := options.Opts["path"]; !ok {
|
if _, ok := options.DriverOpts["path"]; !ok {
|
||||||
options.Opts["path"] = filepath.Join(secretsPath, "filedriver")
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) {
|
func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) {
|
||||||
opts := new(secrets.CreateOptions).
|
opts := new(secrets.CreateOptions).
|
||||||
WithDriver(options.Driver).
|
WithDriver(options.Driver).
|
||||||
WithDriverOpts(options.Opts).
|
WithDriverOpts(options.DriverOpts).
|
||||||
WithName(name)
|
WithName(name)
|
||||||
created, err := secrets.Create(ic.ClientCtx, reader, opts)
|
created, err := secrets.Create(ic.ClientCtx, reader, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user