From 4c340481869ad554bca6cd25eb8523ca07f4ea46 Mon Sep 17 00:00:00 2001 From: zzxwill Date: Fri, 25 Dec 2020 18:25:19 +0800 Subject: [PATCH] Refine error message for trait without `spec.extension.template` Error message of trait without `spec.extension.template` adheres with normal message when executing "vela workloads". To fix #826 --- pkg/commands/refresh.go | 4 ++-- pkg/plugins/cluster.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/commands/refresh.go b/pkg/commands/refresh.go index db34c245d..a2997a248 100644 --- a/pkg/commands/refresh.go +++ b/pkg/commands/refresh.go @@ -57,7 +57,7 @@ func RefreshDefinitions(ctx context.Context, c types.Args, ioStreams cmdutil.IOS } if len(templateErrors) > 0 { for _, e := range templateErrors { - ioStreams.Infof("WARN: %v, you will unable to use this workload capability", e) + ioStreams.Infof("WARN: %v, you will unable to use this workload capability\n", e) } } syncedTemplates = append(syncedTemplates, templates...) @@ -69,7 +69,7 @@ func RefreshDefinitions(ctx context.Context, c types.Args, ioStreams cmdutil.IOS } if len(templateErrors) > 0 { for _, e := range templateErrors { - ioStreams.Infof("WARN: %v, you will unable to use this trait capability", e) + ioStreams.Infof("WARN: %v, you will unable to use this trait capability\n", e) } } syncedTemplates = append(syncedTemplates, templates...) diff --git a/pkg/plugins/cluster.go b/pkg/plugins/cluster.go index 064a82ae0..ec30339be 100644 --- a/pkg/plugins/cluster.go +++ b/pkg/plugins/cluster.go @@ -96,7 +96,7 @@ func GetTraitsFromCluster(ctx context.Context, namespace string, c types.Args, s for _, td := range traitDefs.Items { tmp, err := HandleDefinition(td.Name, syncDir, td.Spec.Reference.Name, td.Annotations, td.Spec.Extension, types.TypeTrait, td.Spec.AppliesToWorkloads) if err != nil { - templateErrors = append(templateErrors, errors.Wrapf(err, "handle trait template `%s` failed\n", td.Name)) + templateErrors = append(templateErrors, errors.Wrapf(err, "handle trait template `%s` failed", td.Name)) continue } if tmp, err = validateCapabilities(tmp, dm, td.Name, td.Spec.Reference); err != nil {