"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/domain/infra/abi/secrets.go" between
podman-3.2.2.tar.gz and podman-3.2.3.tar.gz

About: podman (previous name "libpod") provides a library for applications looking to use the Container Pod concept, popularized by Kubernetes. Podman manages pods, containers, container images, and container volumes.

secrets.go  (podman-3.2.2):secrets.go  (podman-3.2.3)
package abi package abi
import ( import (
"context" "context"
"io" "io"
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"github.com/containers/common/pkg/secrets"
"github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) { func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader io.Reader, options entities.SecretCreateOptions) (*entities.SecretCreateReport, error) {
data, _ := ioutil.ReadAll(reader) data, _ := ioutil.ReadAll(reader)
secretsPath := ic.Libpod.GetSecretsStorageDir() secretsPath := ic.Libpod.GetSecretsStorageDir()
manager, err := secrets.NewManager(secretsPath) manager, err := ic.Libpod.SecretsManager()
if err != nil { if err != nil {
return nil, err return nil, err
} }
driverOptions := make(map[string]string) driverOptions := make(map[string]string)
if options.Driver == "" { if options.Driver == "" {
options.Driver = "file" options.Driver = "file"
} }
if options.Driver == "file" { if options.Driver == "file" {
driverOptions["path"] = filepath.Join(secretsPath, "filedriver") driverOptions["path"] = filepath.Join(secretsPath, "filedriver")
skipping to change at line 39 skipping to change at line 38
secretID, err := manager.Store(name, data, options.Driver, driverOptions) secretID, err := manager.Store(name, data, options.Driver, driverOptions)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &entities.SecretCreateReport{ return &entities.SecretCreateReport{
ID: secretID, ID: secretID,
}, nil }, nil
} }
func (ic *ContainerEngine) SecretInspect(ctx context.Context, nameOrIDs []string ) ([]*entities.SecretInfoReport, []error, error) { func (ic *ContainerEngine) SecretInspect(ctx context.Context, nameOrIDs []string ) ([]*entities.SecretInfoReport, []error, error) {
secretsPath := ic.Libpod.GetSecretsStorageDir() manager, err := ic.Libpod.SecretsManager()
manager, err := secrets.NewManager(secretsPath)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
errs := make([]error, 0, len(nameOrIDs)) errs := make([]error, 0, len(nameOrIDs))
reports := make([]*entities.SecretInfoReport, 0, len(nameOrIDs)) reports := make([]*entities.SecretInfoReport, 0, len(nameOrIDs))
for _, nameOrID := range nameOrIDs { for _, nameOrID := range nameOrIDs {
secret, err := manager.Lookup(nameOrID) secret, err := manager.Lookup(nameOrID)
if err != nil { if err != nil {
if errors.Cause(err).Error() == "no such secret" { if errors.Cause(err).Error() == "no such secret" {
errs = append(errs, err) errs = append(errs, err)
skipping to change at line 74 skipping to change at line 72
}, },
}, },
} }
reports = append(reports, report) reports = append(reports, report)
} }
return reports, errs, nil return reports, errs, nil
} }
func (ic *ContainerEngine) SecretList(ctx context.Context) ([]*entities.SecretIn foReport, error) { func (ic *ContainerEngine) SecretList(ctx context.Context) ([]*entities.SecretIn foReport, error) {
secretsPath := ic.Libpod.GetSecretsStorageDir() manager, err := ic.Libpod.SecretsManager()
manager, err := secrets.NewManager(secretsPath)
if err != nil { if err != nil {
return nil, err return nil, err
} }
secretList, err := manager.List() secretList, err := manager.List()
if err != nil { if err != nil {
return nil, err return nil, err
} }
report := make([]*entities.SecretInfoReport, 0, len(secretList)) report := make([]*entities.SecretInfoReport, 0, len(secretList))
for _, secret := range secretList { for _, secret := range secretList {
reportItem := entities.SecretInfoReport{ reportItem := entities.SecretInfoReport{
skipping to change at line 108 skipping to change at line 105
} }
return report, nil return report, nil
} }
func (ic *ContainerEngine) SecretRm(ctx context.Context, nameOrIDs []string, opt ions entities.SecretRmOptions) ([]*entities.SecretRmReport, error) { func (ic *ContainerEngine) SecretRm(ctx context.Context, nameOrIDs []string, opt ions entities.SecretRmOptions) ([]*entities.SecretRmReport, error) {
var ( var (
err error err error
toRemove []string toRemove []string
reports = []*entities.SecretRmReport{} reports = []*entities.SecretRmReport{}
) )
secretsPath := ic.Libpod.GetSecretsStorageDir() manager, err := ic.Libpod.SecretsManager()
manager, err := secrets.NewManager(secretsPath)
if err != nil { if err != nil {
return nil, err return nil, err
} }
toRemove = nameOrIDs toRemove = nameOrIDs
if options.All { if options.All {
allSecrs, err := manager.List() allSecrs, err := manager.List()
if err != nil { if err != nil {
return nil, err return nil, err
} }
for _, secr := range allSecrs { for _, secr := range allSecrs {
 End of changes. 5 change blocks. 
8 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)