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
c0d9a072
Unverified
Commit
c0d9a072
authored
Oct 19, 2018
by
k8s-ci-robot
Committed by
GitHub
Oct 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #69897 from code-sleuth/develop
Remove error output from stdout to stderr
parents
b7c2d923
7480650e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
jsonpath.go
...io/cli-runtime/pkg/genericclioptions/printers/jsonpath.go
+6
-4
get.sh
test/cmd/get.sh
+1
-1
No files found.
staging/src/k8s.io/cli-runtime/pkg/genericclioptions/printers/jsonpath.go
View file @
c0d9a072
...
...
@@ -17,6 +17,7 @@ limitations under the License.
package
printers
import
(
"bytes"
"encoding/json"
"fmt"
"io"
...
...
@@ -136,10 +137,11 @@ func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
}
if
err
:=
j
.
JSONPath
.
Execute
(
w
,
queryObj
);
err
!=
nil
{
fmt
.
Fprintf
(
w
,
"Error executing template: %v. Printing more information for debugging the template:
\n
"
,
err
)
fmt
.
Fprintf
(
w
,
"
\t
template was:
\n\t\t
%v
\n
"
,
j
.
rawTemplate
)
fmt
.
Fprintf
(
w
,
"
\t
object given to jsonpath engine was:
\n\t\t
%#v
\n\n
"
,
queryObj
)
return
fmt
.
Errorf
(
"error executing jsonpath %q: %v
\n
"
,
j
.
rawTemplate
,
err
)
buf
:=
bytes
.
NewBuffer
(
nil
)
fmt
.
Fprintf
(
buf
,
"Error executing template: %v. Printing more information for debugging the template:
\n
"
,
err
)
fmt
.
Fprintf
(
buf
,
"
\t
template was:
\n\t\t
%v
\n
"
,
j
.
rawTemplate
)
fmt
.
Fprintf
(
buf
,
"
\t
object given to jsonpath engine was:
\n\t\t
%#v
\n\n
"
,
queryObj
)
return
fmt
.
Errorf
(
"error executing jsonpath %q: %v
\n
"
,
j
.
rawTemplate
,
buf
.
String
())
}
return
nil
}
test/cmd/get.sh
View file @
c0d9a072
...
...
@@ -162,7 +162,7 @@ run_kubectl_get_tests() {
kube::test::if_has_string
"
${
output_message
}
"
'valid-pod:'
## check --allow-missing-template-keys=false results in an error for a missing key with jsonpath
output_message
=
$(
!
kubectl get pod valid-pod
--allow-missing-template-keys
=
false
-o
jsonpath
=
'{.missing}'
"
${
kube_flags
[@]
}
"
)
output_message
=
$(
!
kubectl get pod valid-pod
--allow-missing-template-keys
=
false
-o
jsonpath
=
'{.missing}'
2>&1
"
${
kube_flags
[@]
}
"
)
kube::test::if_has_string
"
${
output_message
}
"
'missing is not found'
## check --allow-missing-template-keys=false results in an error for a missing key with go
...
...
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