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
572a0281
Commit
572a0281
authored
Oct 12, 2018
by
Antoine Pelisse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubectl diff: Print error when something goes wrong
parent
e31d14cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
diff.go
pkg/kubectl/cmd/diff/diff.go
+2
-6
diff.sh
test/cmd/diff.sh
+2
-2
No files found.
pkg/kubectl/cmd/diff/diff.go
View file @
572a0281
...
...
@@ -122,8 +122,7 @@ func (d *DiffProgram) getCommand(args ...string) exec.Cmd {
// Run runs the detected diff program. `from` and `to` are the directory to diff.
func
(
d
*
DiffProgram
)
Run
(
from
,
to
string
)
error
{
d
.
getCommand
(
from
,
to
)
.
Run
()
// Ignore diff return code
return
nil
return
d
.
getCommand
(
from
,
to
)
.
Run
()
}
// Printer is used to print an object.
...
...
@@ -396,8 +395,5 @@ func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions) error {
return
err
}
// Error ignore on purpose. diff(1) for example, returns an error if there is any diff.
_
=
differ
.
Run
(
diff
)
return
nil
return
differ
.
Run
(
diff
)
}
test/cmd/diff.sh
View file @
572a0281
...
...
@@ -27,12 +27,12 @@ run_kubectl_diff_tests() {
kube::log::status
"Testing kubectl diff"
# Test that it works when the live object doesn't exist
output_message
=
$(
kubectl diff
-f
hack/testdata/pod.yaml
)
output_message
=
$(
!
kubectl diff
-f
hack/testdata/pod.yaml
)
kube::test::if_has_string
"
${
output_message
}
"
'test-pod'
kubectl apply
-f
hack/testdata/pod.yaml
output_message
=
$(
kubectl diff
-f
hack/testdata/pod-changed.yaml
)
output_message
=
$(
!
kubectl diff
-f
hack/testdata/pod-changed.yaml
)
kube::test::if_has_string
"
${
output_message
}
"
'k8s.gcr.io/pause:3.0'
kubectl delete
-f
hack/testdata/pod.yaml
...
...
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