Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
35f7d251
Commit
35f7d251
authored
Nov 03, 2016
by
Michail Kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl: make edit work with lists again
parent
85fe0f1a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
test-cmd.sh
hack/make-rules/test-cmd.sh
+5
-2
edit.go
pkg/kubectl/cmd/edit.go
+0
-0
No files found.
hack/make-rules/test-cmd.sh
View file @
35f7d251
...
...
@@ -865,6 +865,7 @@ __EOF__
[
"
$(
EDITOR
=
cat
kubectl edit pod/valid-pod |
grep
'name: valid-pod'
)
"
]
[
"
$(
EDITOR
=
cat
kubectl edit
--windows-line-endings
pod/valid-pod | file - |
grep
CRLF
)
"
]
[
!
"
$(
EDITOR
=
cat
kubectl edit
--windows-line-endings
=
false
pod/valid-pod | file - |
grep
CRLF
)
"
]
[
"
$(
EDITOR
=
cat
kubectl edit ns |
grep
'kind: List'
)
"
]
### Label POD YAML file locally without effecting the live pod.
# Pre-condition: name is valid-pod
...
...
@@ -1377,8 +1378,10 @@ __EOF__
echo
-e
'#!/bin/bash\nsed -i "s/image: busybox/image: prom\/busybox/g" $1'
>
/tmp/tmp-editor.sh
chmod
+x /tmp/tmp-editor.sh
output_message
=
$(
!
EDITOR
=
/tmp/tmp-editor.sh kubectl edit
-f
hack/testdata/recursive/pod
--recursive
2>&1
"
${
kube_flags
[@]
}
"
)
# Post-condition: busybox0 & busybox1 PODs are edited, and since busybox2 is malformed, it should error
kube::test::get_object_assert pods
"{{range.items}}{{
$image_field
}}:{{end}}"
'prom/busybox:prom/busybox:'
# Post-condition: busybox0 & busybox1 PODs are not edited, and since busybox2 is malformed, it should error
# The reason why busybox0 & busybox1 PODs are not edited is because the editor tries to load all objects in
# a list but since it contains invalid objects, it will never open.
kube::test::get_object_assert pods
"{{range.items}}{{
$image_field
}}:{{end}}"
'busybox:busybox:'
kube::test::if_has_string
"
${
output_message
}
"
"Object 'Kind' is missing"
# cleaning
rm
/tmp/tmp-editor.sh
...
...
pkg/kubectl/cmd/edit.go
View file @
35f7d251
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment