diff options
author | Aditya Rajan <arajan@redhat.com> | 2021-11-15 14:39:26 +0530 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-12-06 14:37:46 -0500 |
commit | db6b9131ef1a14cd19cdd52425fb60d90862f05e (patch) | |
tree | 71158613e1f1905fea963b8bb6dec3d544658d4d /pkg/specgenutil | |
parent | 08bcd60c8f4147e4817d3e4e488e3394dbb29c64 (diff) | |
download | podman-db6b9131ef1a14cd19cdd52425fb60d90862f05e.tar.gz podman-db6b9131ef1a14cd19cdd52425fb60d90862f05e.tar.bz2 podman-db6b9131ef1a14cd19cdd52425fb60d90862f05e.zip |
secret: honor custom target for secrets with run
Honor custom `target` if specified while running or creating containers
with secret `type=mount`.
Example:
`podman run -it --secret token,type=mount,target=TOKEN ubi8/ubi:latest
bash`
Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'pkg/specgenutil')
-rw-r--r-- | pkg/specgenutil/specgen.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go index 8007e5d8e..eba173a81 100644 --- a/pkg/specgenutil/specgen.go +++ b/pkg/specgenutil/specgen.go @@ -861,6 +861,7 @@ func parseSecrets(secrets []string) ([]specgen.Secret, map[string]string, error) if len(split) == 1 { mountSecret := specgen.Secret{ Source: val, + Target: target, UID: uid, GID: gid, Mode: mode, @@ -926,11 +927,9 @@ func parseSecrets(secrets []string) ([]specgen.Secret, map[string]string, error) return nil, nil, errors.Wrapf(secretParseError, "no source found %s", val) } if secretType == "mount" { - if target != "" { - return nil, nil, errors.Wrapf(secretParseError, "target option is invalid for mounted secrets") - } mountSecret := specgen.Secret{ Source: source, + Target: target, UID: uid, GID: gid, Mode: mode, |