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()
|
||||
|
||||
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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user