Skip to content

Commit

Permalink
server/container_create: Simplify command/args join
Browse files Browse the repository at this point in the history
The old code was needlessly splitting either kubeCommands or kubeArgs
into [0] and [1:].  The new code doesn't bother with that.  From
[1,2], all we need to do is append kubeArgs to kubeCommands, and we
can do that in one line.

[1]: https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact
[2]: https://github.com/opencontainers/image-spec/blob/v1.0.1/conversion.md#verbatim-fields

Signed-off-by: W. Trevor King <[email protected]>
  • Loading branch information
wking committed Jan 24, 2018
1 parent cff96ec commit c93ca85
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,7 @@ func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, ociConfig *v1.
return nil, fmt.Errorf("no command specified")
}

// create entrypoint and args
var entrypoint string
var args []string
if len(kubeCommands) != 0 {
entrypoint = kubeCommands[0]
args = append(kubeCommands[1:], kubeArgs...)
} else {
entrypoint = kubeArgs[0]
args = kubeArgs[1:]
}

processArgs := append([]string{entrypoint}, args...)
processArgs := append(kubeCommands, kubeArgs...)

logrus.Debugf("OCI process args %v", processArgs)

Expand Down

0 comments on commit c93ca85

Please sign in to comment.