Merge pull request #3656 from jwhonce/wip/env

Fix commit --changes env=X=Y
This commit is contained in:
OpenShift Merge Robot
2019-07-29 21:57:08 +02:00
committed by GitHub
2 changed files with 12 additions and 7 deletions

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/containers/libpod/pkg/errorhandling"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
@ -18,6 +17,7 @@ import (
"github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/image" "github.com/containers/libpod/libpod/image"
ann "github.com/containers/libpod/pkg/annotations" ann "github.com/containers/libpod/pkg/annotations"
"github.com/containers/libpod/pkg/errorhandling"
"github.com/containers/libpod/pkg/inspect" "github.com/containers/libpod/pkg/inspect"
ns "github.com/containers/libpod/pkg/namespaces" ns "github.com/containers/libpod/pkg/namespaces"
"github.com/containers/libpod/pkg/rootless" "github.com/containers/libpod/pkg/rootless"
@ -77,7 +77,11 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
writer = os.Stderr writer = os.Stderr
} }
newImage, err := runtime.ImageRuntime().New(ctx, c.InputArgs[0], rtc.SignaturePolicyPath, GetAuthFile(""), writer, nil, image.SigningOptions{}, false, nil) name := ""
if len(c.InputArgs) != 0 {
name = c.InputArgs[0]
}
newImage, err := runtime.ImageRuntime().New(ctx, name, rtc.SignaturePolicyPath, GetAuthFile(""), writer, nil, image.SigningOptions{}, false, nil)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }

View File

@ -177,6 +177,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
return nil, errors.Errorf("invalid env variable %q: not defined in your environment", name) return nil, errors.Errorf("invalid env variable %q: not defined in your environment", name)
} }
} else { } else {
name = change[0]
val = strings.Join(change[1:], " ") val = strings.Join(change[1:], " ")
} }
if !isEnvCleared { // Multiple values are valid, only clear once. if !isEnvCleared { // Multiple values are valid, only clear once.