1
0
mirror of https://github.com/docker/cli.git synced 2026-01-13 18:22:35 +03:00

daemon: update: check len inside public function

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: bb05c188927cdc7a5f86dceace3a4043b0dfeb28
Component: engine
This commit is contained in:
Antonio Murdaca
2016-03-15 17:12:20 +01:00
parent 2f4ce11dc1
commit 6decd866d9
3 changed files with 7 additions and 6 deletions

View File

@@ -527,11 +527,9 @@ func (b *Builder) create() (string, error) {
b.tmpContainers[c.ID] = struct{}{}
fmt.Fprintf(b.Stdout, " ---> Running in %s\n", stringid.TruncateID(c.ID))
if len(config.Cmd) > 0 {
// override the entry point that may have been picked up from the base image
if err := b.docker.ContainerUpdateCmdOnBuild(c.ID, config.Cmd); err != nil {
return "", err
}
// override the entry point that may have been picked up from the base image
if err := b.docker.ContainerUpdateCmdOnBuild(c.ID, config.Cmd); err != nil {
return "", err
}
return c.ID, nil

View File

@@ -25,6 +25,9 @@ func (daemon *Daemon) ContainerUpdate(name string, hostConfig *container.HostCon
// ContainerUpdateCmdOnBuild updates Path and Args for the container with ID cID.
func (daemon *Daemon) ContainerUpdateCmdOnBuild(cID string, cmd []string) error {
if len(cmd) == 0 {
return nil
}
c, err := daemon.GetContainer(cID)
if err != nil {
return err

View File

@@ -171,7 +171,7 @@ func TestGetRemoteImageJSON(t *testing.T) {
t.Fatal(err)
}
assertEqual(t, size, int64(154), "Expected size 154")
if len(json) <= 0 {
if len(json) == 0 {
t.Fatal("Expected non-empty json")
}