Fix 'not patched' kubectl error

This commit is contained in:
Jordan Liggitt
2017-03-02 01:00:48 -05:00
parent fa0387c9fe
commit 2802e5af27
2 changed files with 59 additions and 4 deletions

View File

@@ -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)
}