mirror of https://github.com/k3s-io/k3s
Fix kubectl edit: no such file
parent
e953b65501
commit
d5953991d9
|
@ -574,7 +574,7 @@ __EOF__
|
||||||
## kubectl edit can update the image field of a POD. tmp-editor.sh is a fake editor
|
## kubectl edit can update the image field of a POD. tmp-editor.sh is a fake editor
|
||||||
echo -e '#!/bin/bash\nsed -i "s/nginx/gcr.io\/google_containers\/serve_hostname/g" $1' > /tmp/tmp-editor.sh
|
echo -e '#!/bin/bash\nsed -i "s/nginx/gcr.io\/google_containers\/serve_hostname/g" $1' > /tmp/tmp-editor.sh
|
||||||
chmod +x /tmp/tmp-editor.sh
|
chmod +x /tmp/tmp-editor.sh
|
||||||
EDITOR=/tmp/tmp-editor.sh kubectl edit "${kube_flags[@]}" pods/valid-pod
|
EDITOR=/tmp/tmp-editor.sh ${KUBE_OUTPUT_HOSTBIN}/kubectl edit "${kube_flags[@]}" pods/valid-pod
|
||||||
# Post-condition: valid-pod POD has image gcr.io/google_containers/serve_hostname
|
# Post-condition: valid-pod POD has image gcr.io/google_containers/serve_hostname
|
||||||
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'gcr.io/google_containers/serve_hostname:'
|
kube::test::get_object_assert pods "{{range.items}}{{$image_field}}:{{end}}" 'gcr.io/google_containers/serve_hostname:'
|
||||||
# cleaning
|
# cleaning
|
||||||
|
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
gruntime "runtime"
|
gruntime "runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -199,7 +200,7 @@ outter:
|
||||||
|
|
||||||
// launch the editor
|
// launch the editor
|
||||||
editedDiff := edited
|
editedDiff := edited
|
||||||
edited, file, err = edit.LaunchTempFile(fmt.Sprintf("%s-edit-", os.Args[0]), ext, buf)
|
edited, file, err = edit.LaunchTempFile(fmt.Sprintf("%s-edit-", path.Base(os.Args[0])), ext, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return preservedFile(err, results.file, out)
|
return preservedFile(err, results.file, out)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue