mirror of
https://github.com/containers/podman.git
synced 2025-12-04 20:28:40 +08:00
update c/{buildah,common,image,storage} to latest main
Signed-off-by: Paul Holzinger <pholzing@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
@@ -9,19 +9,12 @@ import (
|
||||
"os/exec"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/common/pkg/secrets/define"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
// errMissingConfig indicates that one or more of the external actions are not configured
|
||||
errMissingConfig = errors.New("missing config value")
|
||||
|
||||
// errNoSecretData indicates that there is not data associated with an id
|
||||
errNoSecretData = errors.New("no secret data with ID")
|
||||
|
||||
// errInvalidKey indicates that something about your key is wrong
|
||||
errInvalidKey = errors.New("invalid key")
|
||||
)
|
||||
// errMissingConfig indicates that one or more of the external actions are not configured
|
||||
var errMissingConfig = errors.New("missing config value")
|
||||
|
||||
type driverConfig struct {
|
||||
// DeleteCommand contains a shell command that deletes a secret.
|
||||
@@ -111,7 +104,7 @@ func (d *Driver) List() (secrets []string, err error) {
|
||||
// Lookup returns the bytes associated with a secret ID
|
||||
func (d *Driver) Lookup(id string) ([]byte, error) {
|
||||
if strings.Contains(id, "..") {
|
||||
return nil, errInvalidKey
|
||||
return nil, define.ErrInvalidKey
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(context.TODO(), "/bin/sh", "-c", d.LookupCommand)
|
||||
@@ -124,7 +117,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
return nil, fmt.Errorf("%s: %w", id, define.ErrNoSuchSecret)
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
@@ -132,7 +125,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
|
||||
// Store saves the bytes associated with an ID. An error is returned if the ID already exists
|
||||
func (d *Driver) Store(id string, data []byte) error {
|
||||
if strings.Contains(id, "..") {
|
||||
return errInvalidKey
|
||||
return define.ErrInvalidKey
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(context.TODO(), "/bin/sh", "-c", d.StoreCommand)
|
||||
@@ -149,7 +142,7 @@ func (d *Driver) Store(id string, data []byte) error {
|
||||
// Delete removes the secret associated with the specified ID. An error is returned if no matching secret is found.
|
||||
func (d *Driver) Delete(id string) error {
|
||||
if strings.Contains(id, "..") {
|
||||
return errInvalidKey
|
||||
return define.ErrInvalidKey
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(context.TODO(), "/bin/sh", "-c", d.DeleteCommand)
|
||||
@@ -161,7 +154,7 @@ func (d *Driver) Delete(id string) error {
|
||||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
return fmt.Errorf("%s: %w", id, define.ErrNoSuchSecret)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user