Fix pod exec options

Change the command field to an array of strings.
This commit is contained in:
Cesar Wong 2015-05-04 16:21:03 -04:00
parent 1b7749b8d9
commit 283049f679
8 changed files with 37 additions and 15 deletions

View File

@ -1353,8 +1353,8 @@ type PodExecOptions struct {
// Container in which to execute the command. // Container in which to execute the command.
Container string Container string
// Command is the remote command to execute // Command is the remote command to execute; argv array; not executed within a shell.
Command string Command []string
} }
// PodProxyOptions is the query options to a Pod's proxy call // PodProxyOptions is the query options to a Pod's proxy call

View File

@ -1715,7 +1715,12 @@ func init() {
out.Stderr = in.Stderr out.Stderr = in.Stderr
out.TTY = in.TTY out.TTY = in.TTY
out.Container = in.Container out.Container = in.Container
out.Command = in.Command if in.Command != nil {
out.Command = make([]string, len(in.Command))
for i := range in.Command {
out.Command[i] = in.Command[i]
}
}
return nil return nil
}, },
func(in *newer.PodExecOptions, out *PodExecOptions, s conversion.Scope) error { func(in *newer.PodExecOptions, out *PodExecOptions, s conversion.Scope) error {
@ -1727,7 +1732,12 @@ func init() {
out.Stderr = in.Stderr out.Stderr = in.Stderr
out.TTY = in.TTY out.TTY = in.TTY
out.Container = in.Container out.Container = in.Container
out.Command = in.Command if in.Command != nil {
out.Command = make([]string, len(in.Command))
for i := range in.Command {
out.Command[i] = in.Command[i]
}
}
return nil return nil
}, },
func(in *PodList, out *newer.PodList, s conversion.Scope) error { func(in *PodList, out *newer.PodList, s conversion.Scope) error {

View File

@ -1339,8 +1339,8 @@ type PodExecOptions struct {
// Container in which to execute the command. // Container in which to execute the command.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."` Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
// Command is the remote command to execute // Command is the remote command to execute; argv array; not executed within a shell.
Command string `json:"command" description:"the command to execute"` Command []string `json:"command" description:"the command to execute; argv array; not executed within a shell"`
} }
// PodProxyOptions is the query options to a Pod's proxy call // PodProxyOptions is the query options to a Pod's proxy call

View File

@ -1207,8 +1207,8 @@ type PodExecOptions struct {
// Container in which to execute the command. // Container in which to execute the command.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."` Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
// Command is the remote command to execute // Command is the remote command to execute; argv array; not executed within a shell.
Command string `json:"command" description:"the command to execute"` Command []string `json:"command" description:"the command to execute; argv array; not executed within a shell"`
} }
// PodProxyOptions is the query options to a Pod's proxy call // PodProxyOptions is the query options to a Pod's proxy call

View File

@ -1227,8 +1227,8 @@ type PodExecOptions struct {
// Container in which to execute the command. // Container in which to execute the command.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."` Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
// Command is the remote command to execute // Command is the remote command to execute; argv array; not executed within a shell.
Command string `json:"command" description:"the command to execute"` Command []string `json:"command" description:"the command to execute; argv array; not executed within a shell"`
} }
// PodProxyOptions is the query options to a Pod's proxy call // PodProxyOptions is the query options to a Pod's proxy call

View File

@ -1850,7 +1850,12 @@ func convert_v1beta3_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, ou
out.Stderr = in.Stderr out.Stderr = in.Stderr
out.TTY = in.TTY out.TTY = in.TTY
out.Container = in.Container out.Container = in.Container
out.Command = in.Command if in.Command != nil {
out.Command = make([]string, len(in.Command))
for i := range in.Command {
out.Command[i] = in.Command[i]
}
}
return nil return nil
} }
@ -1863,7 +1868,12 @@ func convert_api_PodExecOptions_To_v1beta3_PodExecOptions(in *newer.PodExecOptio
out.Stderr = in.Stderr out.Stderr = in.Stderr
out.TTY = in.TTY out.TTY = in.TTY
out.Container = in.Container out.Container = in.Container
out.Command = in.Command if in.Command != nil {
out.Command = make([]string, len(in.Command))
for i := range in.Command {
out.Command[i] = in.Command[i]
}
}
return nil return nil
} }

View File

@ -1339,8 +1339,8 @@ type PodExecOptions struct {
// Container in which to execute the command. // Container in which to execute the command.
Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."` Container string `json:"container,omitempty" description:"the container in which to execute the command. Defaults to only container if there is only one container in the pod."`
// Command is the remote command to execute // Command is the remote command to execute; argv array; not executed within a shell.
Command string `json:"command" description:"the command to execute"` Command []string `json:"command" description:"the command to execute; argv array; not executed within a shell"`
} }
// PodProxyOptions is the query options to a Pod's proxy call // PodProxyOptions is the query options to a Pod's proxy call

View File

@ -261,7 +261,9 @@ func ExecLocation(getter ResourceGetter, connInfo client.ConnectionInfoGetter, c
if opts.TTY { if opts.TTY {
params.Add(api.ExecTTYParam, "1") params.Add(api.ExecTTYParam, "1")
} }
params.Add("command", opts.Command) for _, c := range opts.Command {
params.Add("command", c)
}
loc := &url.URL{ loc := &url.URL{
Scheme: nodeScheme, Scheme: nodeScheme,
Host: fmt.Sprintf("%s:%d", nodeHost, nodePort), Host: fmt.Sprintf("%s:%d", nodeHost, nodePort),