From 2f8d56686888234884f20f27703cc9a9a6bff68f Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Mon, 26 Sep 2022 22:05:30 +0200 Subject: [PATCH] feat(plugins): added better error message --- plugins/commons/check.go | 1 + plugins/manager/manager.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/commons/check.go b/plugins/commons/check.go index 3adef2f..515da69 100644 --- a/plugins/commons/check.go +++ b/plugins/commons/check.go @@ -8,6 +8,7 @@ type Check struct { Description string `yaml:"description"` // Description of the check Status string `yaml:"status"` // Status of the check - OK, FAIL Id string `yaml:"id"` // ID of the check - unique identifier for the check - AWS_IAM_001 + Category string `yaml:"category"` // Category of the check - Security, Cost, Performance, Fault Tolerance, Operational Excellence, etc ... Results []Result `yaml:"results"` // Results of the check Duration time.Duration `yaml:"duration"` // Duration of the check StartTime time.Time diff --git a/plugins/manager/manager.go b/plugins/manager/manager.go index afa96a7..5bafb00 100644 --- a/plugins/manager/manager.go +++ b/plugins/manager/manager.go @@ -2,6 +2,7 @@ package manager import ( "encoding/gob" + "fmt" "log" "os" "os/exec" @@ -42,7 +43,12 @@ func RunPlugin(pluginInput commons.Plugin, c *commons.Config) []commons.Tests { // Connect via RPC rpcClient, err := client.Client() if err != nil { + if strings.Contains(err.Error(), "Incompatible API version with plugin") { + fmt.Println("Plugin " + pluginInput.Name + " is not compatible with YATAS. Please update it.") + log.Fatal(err) + } log.Fatal(err) + } // Request the plugin @@ -63,7 +69,7 @@ func RunPlugin(pluginInput commons.Plugin, c *commons.Config) []commons.Tests { // This prevents users from executing bad plugins or executing a plugin // directory. It is a UX feature, not a security feature. var handshakeConfig = plugin.HandshakeConfig{ - ProtocolVersion: 3, + ProtocolVersion: 1, MagicCookieKey: "BASIC_PLUGIN", MagicCookieValue: "hello", }