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
1e71359a
Commit
1e71359a
authored
Jul 20, 2016
by
juanvallejo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix annotate.go single resource check
parent
8972b4ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
annotate.go
pkg/kubectl/cmd/annotate.go
+12
-10
No files found.
pkg/kubectl/cmd/annotate.go
View file @
1e71359a
...
...
@@ -188,16 +188,7 @@ func (o *AnnotateOptions) Complete(f *cmdutil.Factory, out io.Writer, cmd *cobra
// Validate checks to the AnnotateOptions to see if there is sufficient information run the command.
func
(
o
AnnotateOptions
)
Validate
(
args
[]
string
)
error
{
if
err
:=
validateAnnotations
(
o
.
removeAnnotations
,
o
.
newAnnotations
);
err
!=
nil
{
return
err
}
// only apply resource version locking on a single resource
if
len
(
o
.
resources
)
>
1
&&
len
(
o
.
resourceVersion
)
>
0
{
return
fmt
.
Errorf
(
"--resource-version may only be used with a single resource"
)
}
return
nil
return
validateAnnotations
(
o
.
removeAnnotations
,
o
.
newAnnotations
)
}
// RunAnnotate does the work
...
...
@@ -207,6 +198,17 @@ func (o AnnotateOptions) RunAnnotate() error {
return
err
}
var
singularResource
bool
r
.
IntoSingular
(
&
singularResource
)
// only apply resource version locking on a single resource.
// we must perform this check after o.builder.Do() as
// []o.resources can not not accurately return the proper number
// of resources when they are not passed in "resource/name" format.
if
!
singularResource
&&
len
(
o
.
resourceVersion
)
>
0
{
return
fmt
.
Errorf
(
"--resource-version may only be used with a single resource"
)
}
return
r
.
Visit
(
func
(
info
*
resource
.
Info
,
err
error
)
error
{
if
err
!=
nil
{
return
err
...
...
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