mirror of
https://github.com/containers/podman.git
synced 2025-12-10 15:47:46 +08:00
update c/{buildah,common,image,storage} to latest main
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
13
vendor/github.com/containers/common/pkg/secrets/filedriver/filedriver.go
generated
vendored
13
vendor/github.com/containers/common/pkg/secrets/filedriver/filedriver.go
generated
vendored
@@ -9,6 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/containers/common/pkg/secrets/define"
|
||||
"github.com/containers/storage/pkg/fileutils"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"golang.org/x/exp/maps"
|
||||
@@ -17,12 +18,6 @@ import (
|
||||
// secretsDataFile is the file where secrets data/payload will be stored
|
||||
var secretsDataFile = "secretsdata.json"
|
||||
|
||||
// errNoSecretData indicates that there is not data associated with an id
|
||||
var errNoSecretData = errors.New("no secret data with ID")
|
||||
|
||||
// errNoSecretData indicates that there is secret data already associated with an id
|
||||
var errSecretIDExists = errors.New("secret data with ID already exists")
|
||||
|
||||
// Driver is the filedriver object
|
||||
type Driver struct {
|
||||
// secretsDataFilePath is the path to the secretsfile
|
||||
@@ -75,7 +70,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
|
||||
if data, ok := secretData[id]; ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
return nil, fmt.Errorf("%s: %w", id, define.ErrNoSuchSecret)
|
||||
}
|
||||
|
||||
// Store stores the bytes associated with an ID. An error is returned if the ID already exists
|
||||
@@ -88,7 +83,7 @@ func (d *Driver) Store(id string, data []byte) error {
|
||||
return err
|
||||
}
|
||||
if _, ok := secretData[id]; ok {
|
||||
return fmt.Errorf("%s: %w", id, errSecretIDExists)
|
||||
return fmt.Errorf("%s: %w", id, define.ErrSecretIDExists)
|
||||
}
|
||||
secretData[id] = data
|
||||
marshalled, err := json.MarshalIndent(secretData, "", " ")
|
||||
@@ -113,7 +108,7 @@ func (d *Driver) Delete(id string) error {
|
||||
if _, ok := secretData[id]; ok {
|
||||
delete(secretData, id)
|
||||
} else {
|
||||
return fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
return fmt.Errorf("%s: %w", id, define.ErrNoSuchSecret)
|
||||
}
|
||||
marshalled, err := json.MarshalIndent(secretData, "", " ")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user