mirror of
https://github.com/containers/podman.git
synced 2025-11-14 01:57:58 +08:00
Vendor in containers/(storage,image, common, buildah)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
11
vendor/github.com/containers/common/pkg/secrets/filedriver/filedriver.go
generated
vendored
11
vendor/github.com/containers/common/pkg/secrets/filedriver/filedriver.go
generated
vendored
@@ -2,13 +2,14 @@ package filedriver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// secretsDataFile is the file where secrets data/payload will be stored
|
||||
@@ -75,7 +76,7 @@ func (d *Driver) Lookup(id string) ([]byte, error) {
|
||||
if data, ok := secretData[id]; ok {
|
||||
return data, nil
|
||||
}
|
||||
return nil, errors.Wrapf(errNoSecretData, "%s", id)
|
||||
return nil, fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
}
|
||||
|
||||
// Store stores the bytes associated with an ID. An error is returned if the ID arleady exists
|
||||
@@ -88,7 +89,7 @@ func (d *Driver) Store(id string, data []byte) error {
|
||||
return err
|
||||
}
|
||||
if _, ok := secretData[id]; ok {
|
||||
return errors.Wrapf(errSecretIDExists, "%s", id)
|
||||
return fmt.Errorf("%s: %w", id, errSecretIDExists)
|
||||
}
|
||||
secretData[id] = data
|
||||
marshalled, err := json.MarshalIndent(secretData, "", " ")
|
||||
@@ -113,7 +114,7 @@ func (d *Driver) Delete(id string) error {
|
||||
if _, ok := secretData[id]; ok {
|
||||
delete(secretData, id)
|
||||
} else {
|
||||
return errors.Wrap(errNoSecretData, id)
|
||||
return fmt.Errorf("%s: %w", id, errNoSecretData)
|
||||
}
|
||||
marshalled, err := json.MarshalIndent(secretData, "", " ")
|
||||
if err != nil {
|
||||
@@ -131,7 +132,7 @@ func (d *Driver) getAllData() (map[string][]byte, error) {
|
||||
// check if the db file exists
|
||||
_, err := os.Stat(d.secretsDataFilePath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// the file will be created later on a store()
|
||||
return make(map[string][]byte), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user