mirror of https://github.com/k3s-io/k3s
Merge pull request #62244 from CaoShuFeng/raw
Automatic merge from submit-queue (batch tested with PRs 62244, 63685). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fix "kubectl create --raw" Before this change: ``` $ kubectl create -f pod.json --raw=https://172.16.29.130:443/api/v1/namespaces/default/pods --as=tom --as-group=aaaaa Error from server (Forbidden): unknown ``` After this change: ``` $ kubectl create -f pod.json --raw=https://172.16.29.130:443/api/v1/namespaces/default/pods --as=tom --as-group=aaaaa Error from server (Forbidden): pods is forbidden: User "tom" cannot create pods in the namespace "default" ``` /assign @soltysh **Release note**: ```release-note NONE ```pull/8/head
commit
6203b621ba
|
@ -284,12 +284,16 @@ func (o *CreateOptions) raw(f cmdutil.Factory) error {
|
|||
}
|
||||
}
|
||||
// TODO post content with stream. Right now it ignores body content
|
||||
bytes, err := restClient.Post().RequestURI(o.Raw).Body(data).DoRaw()
|
||||
result := restClient.Post().RequestURI(o.Raw).Body(data).Do()
|
||||
if err := result.Error(); err != nil {
|
||||
return err
|
||||
}
|
||||
body, err := result.Raw()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(o.Out, "%v", string(bytes))
|
||||
fmt.Fprintf(o.Out, "%v", string(body))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue