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
ad11a1b7
Unverified
Commit
ad11a1b7
authored
Jul 27, 2018
by
juanvallejo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update exit code to 0 if patch not needed
parent
4d5d2664
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
patch.go
pkg/kubectl/cmd/patch.go
+1
-7
core.sh
test/cmd/core.sh
+6
-2
No files found.
pkg/kubectl/cmd/patch.go
View file @
ad11a1b7
...
...
@@ -245,14 +245,8 @@ func (o *PatchOptions) RunPatch() error {
if
err
!=
nil
{
return
err
}
printer
.
PrintObj
(
info
.
Object
,
o
.
Out
)
// if object was not successfully patched, exit with error code 1
if
!
didPatch
{
return
cmdutil
.
ErrExit
}
return
nil
return
printer
.
PrintObj
(
info
.
Object
,
o
.
Out
)
}
count
++
...
...
test/cmd/core.sh
View file @
ad11a1b7
...
...
@@ -435,8 +435,12 @@ run_pod_tests() {
## Patch can modify a local object
kubectl patch
--local
-f
pkg/kubectl/validation/testdata/v1/validPod.yaml
--patch
=
'{"spec": {"restartPolicy":"Never"}}'
-o
yaml |
grep
-q
"Never"
## Patch fails with error message "not patched" and exit code 1
output_message
=
$(
!
kubectl patch
"
${
kube_flags
[@]
}
"
pod valid-pod
-p
=
'{"spec":{"replicas":7}}'
2>&1
)
## Patch fails with type restore error and exit code 1
output_message
=
$(
!
kubectl patch
"
${
kube_flags
[@]
}
"
pod valid-pod
-p
=
'{"metadata":{"labels":"invalid"}}'
2>&1
)
kube::test::if_has_string
"
${
output_message
}
"
'cannot restore map from string'
## Patch exits with error message "not patched" and exit code 0 when no-op occurs
output_message
=
$(
kubectl patch
"
${
kube_flags
[@]
}
"
pod valid-pod
-p
=
'{"metadata":{"labels":{"name":"valid-pod"}}}'
2>&1
)
kube::test::if_has_string
"
${
output_message
}
"
'not patched'
## Patch pod can change image
...
...
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