mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Fix 'not patched' kubectl error
This commit is contained in:
@@ -200,10 +200,6 @@ func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
|
||||
}
|
||||
count++
|
||||
|
||||
if err := info.Refresh(patchedObj, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
oldData, err := json.Marshal(info.Object)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -216,6 +212,11 @@ func RunPatch(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
|
||||
dataChangedMsg = "patched"
|
||||
}
|
||||
|
||||
// After computing whether we changed data, refresh the resource info with the resulting object
|
||||
if err := info.Refresh(patchedObj, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(options.OutputFormat) > 0 && options.OutputFormat != "name" {
|
||||
return cmdutil.PrintResourceInfoForCommand(cmd, info, f, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user