Skip to content

Commit

Permalink
Fix pod exec options
Browse files Browse the repository at this point in the history
Change the command field to an array of strings.
  • Loading branch information
csrwng committed May 5, 2015
1 parent 74c07f1 commit 83fd036
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/api/types.go
Expand Up @@ -1354,7 +1354,7 @@ type PodExecOptions struct {
Container string

// Command is the remote command to execute
Command string
Command []string
}

// PodProxyOptions is the query options to a Pod's proxy call
Expand Down
14 changes: 12 additions & 2 deletions pkg/api/v1/conversion.go
Expand Up @@ -1715,7 +1715,12 @@ func init() {
out.Stderr = in.Stderr
out.TTY = in.TTY
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
},
func(in *newer.PodExecOptions, out *PodExecOptions, s conversion.Scope) error {
Expand All @@ -1727,7 +1732,12 @@ func init() {
out.Stderr = in.Stderr
out.TTY = in.TTY
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
},
func(in *PodList, out *newer.PodList, s conversion.Scope) error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1/types.go
Expand Up @@ -1340,7 +1340,7 @@ type PodExecOptions struct {
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 string `json:"command" description:"the command to execute"`
Command []string `json:"command" description:"the command to execute"`
}

// PodProxyOptions is the query options to a Pod's proxy call
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1beta1/types.go
Expand Up @@ -1208,7 +1208,7 @@ type PodExecOptions struct {
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 string `json:"command" description:"the command to execute"`
Command []string `json:"command" description:"the command to execute"`
}

// PodProxyOptions is the query options to a Pod's proxy call
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1beta2/types.go
Expand Up @@ -1228,7 +1228,7 @@ type PodExecOptions struct {
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 string `json:"command" description:"the command to execute"`
Command []string `json:"command" description:"the command to execute"`
}

// PodProxyOptions is the query options to a Pod's proxy call
Expand Down
14 changes: 12 additions & 2 deletions pkg/api/v1beta3/conversion.go
Expand Up @@ -1850,7 +1850,12 @@ func convert_v1beta3_PodExecOptions_To_api_PodExecOptions(in *PodExecOptions, ou
out.Stderr = in.Stderr
out.TTY = in.TTY
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
}

Expand All @@ -1863,7 +1868,12 @@ func convert_api_PodExecOptions_To_v1beta3_PodExecOptions(in *newer.PodExecOptio
out.Stderr = in.Stderr
out.TTY = in.TTY
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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1beta3/types.go
Expand Up @@ -1340,7 +1340,7 @@ type PodExecOptions struct {
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 string `json:"command" description:"the command to execute"`
Command []string `json:"command" description:"the command to execute"`
}

// PodProxyOptions is the query options to a Pod's proxy call
Expand Down
4 changes: 3 additions & 1 deletion pkg/registry/pod/rest.go
Expand Up @@ -261,7 +261,9 @@ func ExecLocation(getter ResourceGetter, connInfo client.ConnectionInfoGetter, c
if opts.TTY {
params.Add(api.ExecTTYParam, "1")
}
params.Add("command", opts.Command)
for _, c := range opts.Command {
params.Add("command", c)
}
loc := &url.URL{
Scheme: nodeScheme,
Host: fmt.Sprintf("%s:%d", nodeHost, nodePort),
Expand Down

0 comments on commit 83fd036

Please sign in to comment.