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
This commit is contained in:
zzxwill
2020-12-25 18:25:19 +08:00
parent 1e6248d189
commit 4c34048186
2 changed files with 3 additions and 3 deletions

View File

@@ -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...)

View File

@@ -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 {