summaryrefslogtreecommitdiff
path: root/cmd/podman/shared/parse
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-02-19 15:55:14 +0100
committerValentin Rothberg <rothberg@redhat.com>2020-03-03 11:47:24 +0100
commitad8e0e5e49a96146d52cfa41945afbe973ba30af (patch)
tree0ac13e0869ade22faf212a0cf2602ac832d90820 /cmd/podman/shared/parse
parent1641ee61802ad5e13a9ddf0a20099fe31f73768d (diff)
downloadpodman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.tar.gz
podman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.tar.bz2
podman-ad8e0e5e49a96146d52cfa41945afbe973ba30af.zip
consolidate env handling into pkg/env
Env-variable related code is scattered across several packages making it hard to maintain and extend. Consolidate the code into a new pkg/env package. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'cmd/podman/shared/parse')
-rw-r--r--cmd/podman/shared/parse/parse.go19
1 files changed, 2 insertions, 17 deletions
diff --git a/cmd/podman/shared/parse/parse.go b/cmd/podman/shared/parse/parse.go
index 79449029d..03cda268c 100644
--- a/cmd/podman/shared/parse/parse.go
+++ b/cmd/podman/shared/parse/parse.go
@@ -90,6 +90,8 @@ func GetAllLabels(labelFile, inputLabels []string) (map[string]string, error) {
// all environment variables, even those sourced from files, but
// that would require a substantial rework.
if err := parseEnvFile(labels, file); err != nil {
+ // FIXME: parseEnvFile is using parseEnv, so we need to add extra
+ // logic for labels.
return nil, err
}
}
@@ -107,23 +109,6 @@ func GetAllLabels(labelFile, inputLabels []string) (map[string]string, error) {
return labels, nil
}
-// reads a file of line terminated key=value pairs, and overrides any keys
-// present in the file with additional pairs specified in the override parameter
-// for env-file and labels-file flags
-func ReadKVStrings(env map[string]string, files []string, override []string) error {
- for _, ef := range files {
- if err := parseEnvFile(env, ef); err != nil {
- return err
- }
- }
- for _, line := range override {
- if err := parseEnv(env, line); err != nil {
- return err
- }
- }
- return nil
-}
-
func parseEnv(env map[string]string, line string) error {
data := strings.SplitN(line, "=", 2)