Commit b020a4ba authored by WanLinghao's avatar WanLinghao

fix bugs that break processing when printing errors occur in kubectl

parent b5cd7d81
...@@ -153,7 +153,9 @@ func (o PauseConfig) RunPause() error { ...@@ -153,7 +153,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
} }
...@@ -169,7 +171,9 @@ func (o PauseConfig) RunPause() error { ...@@ -169,7 +171,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)
......
...@@ -158,7 +158,9 @@ func (o ResumeConfig) RunResume() error { ...@@ -158,7 +158,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)
...@@ -173,7 +175,9 @@ func (o ResumeConfig) RunResume() error { ...@@ -173,7 +175,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)
......
...@@ -415,7 +415,7 @@ func (o *EnvOptions) RunEnv() error { ...@@ -415,7 +415,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
} }
...@@ -433,7 +433,7 @@ func (o *EnvOptions) RunEnv() error { ...@@ -433,7 +433,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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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
} }
......
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