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
d81f7a0f
Commit
d81f7a0f
authored
May 19, 2016
by
Dmitry Shulyak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use strategic patch to replace changeCause in patch command
parent
30e25ada
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
patch.go
pkg/kubectl/cmd/patch.go
+4
-3
No files found.
pkg/kubectl/cmd/patch.go
View file @
d81f7a0f
...
@@ -167,17 +167,18 @@ func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
...
@@ -167,17 +167,18 @@ func RunPatch(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
if
!
options
.
Local
{
if
!
options
.
Local
{
helper
:=
resource
.
NewHelper
(
client
,
mapping
)
helper
:=
resource
.
NewHelper
(
client
,
mapping
)
patchedObject
,
err
:=
helper
.
Patch
(
namespace
,
name
,
patchType
,
patchBytes
)
_
,
err
:=
helper
.
Patch
(
namespace
,
name
,
patchType
,
patchBytes
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
cmdutil
.
ShouldRecord
(
cmd
,
info
)
{
if
cmdutil
.
ShouldRecord
(
cmd
,
info
)
{
if
err
:=
cmdutil
.
RecordChangeCause
(
patchedObject
,
f
.
Command
());
err
==
nil
{
// don't return an error on failure. The patch itself succeeded, its only the hint for that change that failed
// don't return an error on failure. The patch itself succeeded, its only the hint for that change that failed
// don't bother checking for failures of this replace, because a failure to indicate the hint doesn't fail the command
// don't bother checking for failures of this replace, because a failure to indicate the hint doesn't fail the command
// also, don't force the replacement. If the replacement fails on a resourceVersion conflict, then it means this
// also, don't force the replacement. If the replacement fails on a resourceVersion conflict, then it means this
// record hint is likely to be invalid anyway, so avoid the bad hint
// record hint is likely to be invalid anyway, so avoid the bad hint
resource
.
NewHelper
(
client
,
mapping
)
.
Replace
(
namespace
,
name
,
false
,
patchedObject
)
patch
,
err
:=
cmdutil
.
ChangeResourcePatch
(
info
,
f
.
Command
())
if
err
==
nil
{
helper
.
Patch
(
info
.
Namespace
,
info
.
Name
,
api
.
StrategicMergePatchType
,
patch
)
}
}
}
}
count
++
count
++
...
...
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