From 4c2d66e7b4566a8b50b0cafe207a7a3ab5f4bae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Mej=C3=ADas=20Rodr=C3=ADguez?= Date: Fri, 9 Aug 2019 14:57:35 -0400 Subject: [PATCH] Add suggestions to FatalLevel log messages --- cmd/config.go | 3 ++- cmd/stackRemove.go | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index c9e6520..af80b55 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -28,7 +28,8 @@ var configCmd = &cobra.Command{ } if !keyExists { logrus.WithFields(logrus.Fields{ - "key": args[0], + "key": args[0], + "suggestions": "Try looking up the available configuration keys: psu config ls --keys", }).Fatal("Unknown configuration key") } diff --git a/cmd/stackRemove.go b/cmd/stackRemove.go index a0dee99..e4087b7 100644 --- a/cmd/stackRemove.go +++ b/cmd/stackRemove.go @@ -1,6 +1,8 @@ package cmd import ( + "fmt" + "github.com/greenled/portainer-stack-utils/client" "github.com/greenled/portainer-stack-utils/common" "github.com/sirupsen/logrus" @@ -82,8 +84,9 @@ var stackRemoveCmd = &cobra.Command{ }).Debug("Stack not found") if viper.GetBool("stack.remove.strict") { logrus.WithFields(logrus.Fields{ - "stack": stackName, - "endpoint": endpointId, + "stack": stackName, + "endpoint": endpointId, + "suggestions": fmt.Sprintf("Try with a different endpoint: psu stack rm %s --endpoint ENDPOINT_ID", stackName), }).Fatal("Stack does not exist") } default: