mirror of
https://github.com/containers/podman.git
synced 2025-11-13 17:47:13 +08:00
vendor in latest containers/(storage,common,image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
25
vendor/github.com/containers/common/pkg/secrets/shelldriver/shelldriver.go
generated
vendored
25
vendor/github.com/containers/common/pkg/secrets/shelldriver/shelldriver.go
generated
vendored
@@ -3,12 +3,12 @@ package shelldriver
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
@@ -27,22 +27,33 @@ var (
|
||||
type driverConfig struct {
|
||||
// DeleteCommand contains a shell command that deletes a secret.
|
||||
// The secret id is provided as environment variable SECRET_ID
|
||||
DeleteCommand string `mapstructure:"delete"`
|
||||
DeleteCommand string
|
||||
// ListCommand contains a shell command that lists all secrets.
|
||||
// The output is expected to be one id per line
|
||||
ListCommand string `mapstructure:"list"`
|
||||
ListCommand string
|
||||
// LookupCommand contains a shell command that retrieves a secret.
|
||||
// The secret id is provided as environment variable SECRET_ID
|
||||
LookupCommand string `mapstructure:"lookup"`
|
||||
LookupCommand string
|
||||
// StoreCommand contains a shell command that stores a secret.
|
||||
// The secret id is provided as environment variable SECRET_ID
|
||||
// The secret value itself is provided over stdin
|
||||
StoreCommand string `mapstructure:"store"`
|
||||
StoreCommand string
|
||||
}
|
||||
|
||||
func (cfg *driverConfig) ParseOpts(opts map[string]string) error {
|
||||
if err := mapstructure.Decode(opts, cfg); err != nil {
|
||||
return err
|
||||
for key, value := range opts {
|
||||
switch key {
|
||||
case "delete":
|
||||
cfg.DeleteCommand = value
|
||||
case "list":
|
||||
cfg.ListCommand = value
|
||||
case "lookup":
|
||||
cfg.LookupCommand = value
|
||||
case "store":
|
||||
cfg.StoreCommand = value
|
||||
default:
|
||||
return fmt.Errorf("invalid shell driver option: %q", key)
|
||||
}
|
||||
}
|
||||
if cfg.DeleteCommand == "" ||
|
||||
cfg.ListCommand == "" ||
|
||||
|
||||
Reference in New Issue
Block a user