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
8ce921ed
Commit
8ce921ed
authored
Jun 08, 2015
by
krousey
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9357 from mikedanese/kubectl-kind-err
improve kubectl error message when an object with no kind is passed to the resource builder
parents
3b25ff11
7b7d8ccb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
visitor.go
pkg/kubectl/resource/visitor.go
+5
-3
No files found.
pkg/kubectl/resource/visitor.go
View file @
8ce921ed
...
@@ -37,6 +37,8 @@ import (
...
@@ -37,6 +37,8 @@ import (
)
)
// Visitor lets clients walk a list of resources.
// Visitor lets clients walk a list of resources.
// TODO: we should rethink how we handle errors in the visit loop
// (See https://github.com/GoogleCloudPlatform/kubernetes/pull/9357#issuecomment-109600305)
type
Visitor
interface
{
type
Visitor
interface
{
Visit
(
VisitorFunc
)
error
Visit
(
VisitorFunc
)
error
}
}
...
@@ -220,7 +222,7 @@ func (v *PathVisitor) Visit(fn VisitorFunc) error {
...
@@ -220,7 +222,7 @@ func (v *PathVisitor) Visit(fn VisitorFunc) error {
if
!
v
.
IgnoreErrors
{
if
!
v
.
IgnoreErrors
{
return
err
return
err
}
}
glog
.
V
(
2
)
.
Infof
(
"Unable to load file %q: %v
"
,
v
.
Path
,
err
)
fmt
.
Fprintf
(
os
.
Stderr
,
"error: unable to load file %q: %v
\n
"
,
v
.
Path
,
err
)
return
nil
return
nil
}
}
return
fn
(
info
)
return
fn
(
info
)
...
@@ -283,7 +285,7 @@ func (v *DirectoryVisitor) Visit(fn VisitorFunc) error {
...
@@ -283,7 +285,7 @@ func (v *DirectoryVisitor) Visit(fn VisitorFunc) error {
if
!
v
.
IgnoreErrors
{
if
!
v
.
IgnoreErrors
{
return
err
return
err
}
}
glog
.
V
(
2
)
.
Infof
(
"Unable to load file %q: %v
"
,
path
,
err
)
fmt
.
Fprintf
(
os
.
Stderr
,
"error: unable to load file %q: %v
\n
"
,
path
,
err
)
return
nil
return
nil
}
}
return
fn
(
info
)
return
fn
(
info
)
...
@@ -471,7 +473,7 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error {
...
@@ -471,7 +473,7 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error {
info
,
err
:=
v
.
InfoForData
(
ext
.
RawJSON
,
v
.
Source
)
info
,
err
:=
v
.
InfoForData
(
ext
.
RawJSON
,
v
.
Source
)
if
err
!=
nil
{
if
err
!=
nil
{
if
v
.
IgnoreErrors
{
if
v
.
IgnoreErrors
{
glog
.
Warningf
(
"Could not read an encoded object from %s: %v
"
,
v
.
Source
,
err
)
fmt
.
Fprintf
(
os
.
Stderr
,
"error: could not read an encoded object from %s: %v
\n
"
,
v
.
Source
,
err
)
glog
.
V
(
4
)
.
Infof
(
"Unreadable: %s"
,
string
(
ext
.
RawJSON
))
glog
.
V
(
4
)
.
Infof
(
"Unreadable: %s"
,
string
(
ext
.
RawJSON
))
continue
continue
}
}
...
...
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