Unverified Commit 7a7ab200 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #64242 from WanLinghao/ctl_print_fix

Automatic merge from submit-queue (batch tested with PRs 63417, 64249, 64242, 64128, 64275). 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>. fix bugs that break processing when printing errors occur in kubectl **What this PR does / why we need it**: The process should continue when error happens, this patch fix the problem **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 6b34d1e5 b020a4ba
......@@ -154,7 +154,9 @@ func (o PauseConfig) RunPause() error {
allErrs = append(allErrs, err)
continue
}
printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out)
if err = printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out); err != nil {
allErrs = append(allErrs, err)
}
continue
}
......@@ -170,7 +172,9 @@ func (o PauseConfig) RunPause() error {
allErrs = append(allErrs, err)
continue
}
printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out)
if err = printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out); err != nil {
allErrs = append(allErrs, err)
}
}
return utilerrors.NewAggregate(allErrs)
......
......@@ -159,7 +159,9 @@ func (o ResumeConfig) RunResume() error {
allErrs = append(allErrs, err)
continue
}
printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out)
if err = printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out); err != nil {
allErrs = append(allErrs, err)
}
}
obj, err := resource.NewHelper(info.Client, info.Mapping).Patch(info.Namespace, info.Name, types.StrategicMergePatchType, patch.Patch)
......@@ -174,7 +176,9 @@ func (o ResumeConfig) RunResume() error {
allErrs = append(allErrs, err)
continue
}
printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out)
if err = printer.PrintObj(cmdutil.AsDefaultVersionedOrOriginal(info.Object, info.Mapping), o.Out); err != nil {
allErrs = append(allErrs, err)
}
}
return utilerrors.NewAggregate(allErrs)
......
......@@ -482,7 +482,7 @@ func (o *EnvOptions) RunEnv() error {
if o.Local || o.dryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
continue
}
......@@ -500,7 +500,7 @@ func (o *EnvOptions) RunEnv() error {
}
if err := o.PrintObj(actual, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
}
return utilerrors.NewAggregate(allErrs)
......
......@@ -276,7 +276,7 @@ func (o *SetImageOptions) Run() error {
if o.Local || o.DryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
continue
}
......@@ -289,7 +289,7 @@ func (o *SetImageOptions) Run() error {
}
if err := o.PrintObj(actual, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
}
return utilerrors.NewAggregate(allErrs)
......
......@@ -277,7 +277,7 @@ func (o *SetResourcesOptions) Run() error {
if o.Local || o.DryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
continue
}
......@@ -289,7 +289,7 @@ func (o *SetResourcesOptions) Run() error {
}
if err := o.PrintObj(actual, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
}
return utilerrors.NewAggregate(allErrs)
......
......@@ -198,7 +198,7 @@ func (o *SetServiceAccountOptions) Run() error {
}
if o.local || o.dryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
return err
patchErrs = append(patchErrs, err)
}
continue
}
......@@ -209,7 +209,7 @@ func (o *SetServiceAccountOptions) Run() error {
}
if err := o.PrintObj(actual, o.Out); err != nil {
return err
patchErrs = append(patchErrs, err)
}
}
return utilerrors.NewAggregate(patchErrs)
......
......@@ -251,7 +251,7 @@ func (o *SubjectOptions) Run(fn updateSubjects) error {
if o.Local || o.DryRun {
if err := o.PrintObj(info.Object, o.Out); err != nil {
return err
allErrs = append(allErrs, err)
}
continue
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment