mirror of https://github.com/k3s-io/k3s
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 ```pull/8/head
commit
7a7ab200ee
|
@ -154,7 +154,9 @@ func (o PauseConfig) RunPause() error {
|
||||||
allErrs = append(allErrs, err)
|
allErrs = append(allErrs, err)
|
||||||
continue
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +172,9 @@ func (o PauseConfig) RunPause() error {
|
||||||
allErrs = append(allErrs, err)
|
allErrs = append(allErrs, err)
|
||||||
continue
|
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)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
|
|
|
@ -159,7 +159,9 @@ func (o ResumeConfig) RunResume() error {
|
||||||
allErrs = append(allErrs, err)
|
allErrs = append(allErrs, err)
|
||||||
continue
|
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)
|
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)
|
allErrs = append(allErrs, err)
|
||||||
continue
|
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)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
|
|
|
@ -482,7 +482,7 @@ func (o *EnvOptions) RunEnv() error {
|
||||||
|
|
||||||
if o.Local || o.dryRun {
|
if o.Local || o.dryRun {
|
||||||
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ func (o *EnvOptions) RunEnv() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.PrintObj(actual, o.Out); err != nil {
|
if err := o.PrintObj(actual, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(allErrs)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
|
|
|
@ -276,7 +276,7 @@ func (o *SetImageOptions) Run() error {
|
||||||
|
|
||||||
if o.Local || o.DryRun {
|
if o.Local || o.DryRun {
|
||||||
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ func (o *SetImageOptions) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.PrintObj(actual, o.Out); err != nil {
|
if err := o.PrintObj(actual, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(allErrs)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
|
|
|
@ -277,7 +277,7 @@ func (o *SetResourcesOptions) Run() error {
|
||||||
|
|
||||||
if o.Local || o.DryRun {
|
if o.Local || o.DryRun {
|
||||||
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ func (o *SetResourcesOptions) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.PrintObj(actual, o.Out); err != nil {
|
if err := o.PrintObj(actual, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(allErrs)
|
return utilerrors.NewAggregate(allErrs)
|
||||||
|
|
|
@ -198,7 +198,7 @@ func (o *SetServiceAccountOptions) Run() error {
|
||||||
}
|
}
|
||||||
if o.local || o.dryRun {
|
if o.local || o.dryRun {
|
||||||
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
||||||
return err
|
patchErrs = append(patchErrs, err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ func (o *SetServiceAccountOptions) Run() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := o.PrintObj(actual, o.Out); err != nil {
|
if err := o.PrintObj(actual, o.Out); err != nil {
|
||||||
return err
|
patchErrs = append(patchErrs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return utilerrors.NewAggregate(patchErrs)
|
return utilerrors.NewAggregate(patchErrs)
|
||||||
|
|
|
@ -251,7 +251,7 @@ func (o *SubjectOptions) Run(fn updateSubjects) error {
|
||||||
|
|
||||||
if o.Local || o.DryRun {
|
if o.Local || o.DryRun {
|
||||||
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
if err := o.PrintObj(info.Object, o.Out); err != nil {
|
||||||
return err
|
allErrs = append(allErrs, err)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue