mirror of https://github.com/k3s-io/k3s
Merge pull request #59285 from Addepar/fix-apply-logging
Automatic merge from submit-queue (batch tested with PRs 59285, 61216). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Do not log unchanged message if a format other than 'name' is specified **What this PR does / why we need it**: When specifying an output format, the "unchanged" message screws up the output format. **Which issue(s) this PR fixes**: Fixes #58836 **Special notes for your reviewer**: N/A **Release note**: ```release-note NONE ```pull/8/head
commit
08f931d84a
|
@ -287,6 +287,9 @@ func RunApply(f cmdutil.Factory, cmd *cobra.Command, out, errOut io.Writer, opti
|
|||
return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving modified configuration from:\n%s\nfor:", info.String()), info.Source, err)
|
||||
}
|
||||
|
||||
// Print object only if output format other than "name" is specified
|
||||
printObject := len(output) > 0 && !shortOutput
|
||||
|
||||
if err := info.Get(); err != nil {
|
||||
if !errors.IsNotFound(err) {
|
||||
return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving current configuration of:\n%s\nfrom server for:", info.String()), info.Source, err)
|
||||
|
@ -310,7 +313,7 @@ func RunApply(f cmdutil.Factory, cmd *cobra.Command, out, errOut io.Writer, opti
|
|||
}
|
||||
|
||||
count++
|
||||
if len(output) > 0 && !shortOutput {
|
||||
if printObject {
|
||||
return cmdutil.PrintObject(cmd, info.Object, out)
|
||||
}
|
||||
cmdutil.PrintSuccess(shortOutput, out, info.Object, dryRun, "created")
|
||||
|
@ -360,14 +363,14 @@ func RunApply(f cmdutil.Factory, cmd *cobra.Command, out, errOut io.Writer, opti
|
|||
visitedUids.Insert(string(uid))
|
||||
}
|
||||
|
||||
if string(patchBytes) == "{}" {
|
||||
if string(patchBytes) == "{}" && !printObject {
|
||||
count++
|
||||
cmdutil.PrintSuccess(shortOutput, out, info.Object, false, "unchanged")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
count++
|
||||
if len(output) > 0 && !shortOutput {
|
||||
if printObject {
|
||||
return cmdutil.PrintObject(cmd, info.Object, out)
|
||||
}
|
||||
cmdutil.PrintSuccess(shortOutput, out, info.Object, dryRun, "configured")
|
||||
|
|
Loading…
Reference in New Issue