Set proper error message on plugin failure

Currently we are setting the error message in a no-space full sentence
which is pretty ugly:

| FATA[0000] Pluginluet-cosignat/usr/local/bin/luet-cosignErrorerror while executing plugin: exit status 1

Signed-off-by: Itxaka <igarcia@suse.com>
This commit is contained in:
Itxaka 2021-10-25 14:09:52 +02:00 committed by Ettore Di Giacinto
parent 144c409908
commit 7cd455fff4

View File

@ -1,6 +1,7 @@
package bus
import (
"fmt"
"github.com/mudler/go-pluggable"
"github.com/mudler/luet/pkg/api/core/types"
)
@ -88,7 +89,8 @@ func (b *Bus) Initialize(ctx *types.Context, plugin ...string) {
for _, e := range b.Manager.Events {
b.Manager.Response(e, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
if r.Errored() {
ctx.Fatal("Plugin", p.Name, "at", p.Executable, "Error", r.Error)
err := fmt.Sprintf("Plugin %s at %s had an error: %s", p.Name, p.Executable, r.Error)
ctx.Fatal(err)
}
ctx.Debug(
"plugin_event",