From c93ca853f319083d9ae8c200d8a077aa754242b3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 19 Jan 2018 10:28:15 -0800 Subject: [PATCH] server/container_create: Simplify command/args join 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 --- server/container_create.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/server/container_create.go b/server/container_create.go index 366cb566ec4d..01820d2d9198 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -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)