try old patch after new patch fails

This commit is contained in:
ymqytw
2016-11-17 10:46:23 -08:00
parent 5efdea63b2
commit f32696e734
18 changed files with 58 additions and 123 deletions

View File

@@ -154,14 +154,6 @@ func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
return err
}
smPatchVersion := strategicpatch.SMPatchVersionLatest
if !options.Local {
smPatchVersion, err = cmdutil.GetServerSupportedSMPatchVersionFromFactory(f)
if err != nil {
return err
}
}
count := 0
err = r.Visit(func(info *resource.Info, err error) error {
if err != nil {
@@ -185,7 +177,7 @@ func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
// 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
// record hint is likely to be invalid anyway, so avoid the bad hint
patch, err := cmdutil.ChangeResourcePatch(info, f.Command(), smPatchVersion)
patch, err := cmdutil.ChangeResourcePatch(info, f.Command())
if err == nil {
helper.Patch(info.Namespace, info.Name, api.StrategicMergePatchType, patch)
}