From ee6382ef8dc8aa6e7b712d90c10b2360897a7d2a Mon Sep 17 00:00:00 2001 From: lynnemorrison Date: Wed, 8 Oct 2025 09:46:49 -0400 Subject: [PATCH] Clearify error message if user tries to uninstall a nonkube site. --- internal/cmd/skupper/system/nonkube/system_uninstall.go | 8 +++++++- .../cmd/skupper/system/nonkube/system_uninstall_test.go | 2 +- internal/nonkube/bootstrap/uninstall.go | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/cmd/skupper/system/nonkube/system_uninstall.go b/internal/cmd/skupper/system/nonkube/system_uninstall.go index e720adb71..cd3c12cc8 100644 --- a/internal/cmd/skupper/system/nonkube/system_uninstall.go +++ b/internal/cmd/skupper/system/nonkube/system_uninstall.go @@ -3,6 +3,7 @@ package nonkube import ( "errors" "fmt" + "net" "os" "path" @@ -99,7 +100,12 @@ func (cmd *CmdSystemUninstall) Run() error { err := cmd.SystemUninstall(string(config.GetPlatform())) if err != nil { - return fmt.Errorf("failed to uninstall : %s", err) + opErr := &net.OpError{} + if errors.As(err, &opErr) { + return fmt.Errorf("Unable to communicate with the Container Engine.\nRun: \"skupper system install\" to prepare the local environment and start the controller.\n\nError: %s", err) + } else { + return fmt.Errorf("Unable to uninstall.\nError: %s", err.Error()) + } } return nil diff --git a/internal/cmd/skupper/system/nonkube/system_uninstall_test.go b/internal/cmd/skupper/system/nonkube/system_uninstall_test.go index ab1b08553..709f0c7e2 100644 --- a/internal/cmd/skupper/system/nonkube/system_uninstall_test.go +++ b/internal/cmd/skupper/system/nonkube/system_uninstall_test.go @@ -139,7 +139,7 @@ func TestCmdSystemUninstall_Run(t *testing.T) { { name: "disable socket fails", disableSocketFails: true, - errorMessage: "failed to uninstall : disable socket fails", + errorMessage: "Unable to uninstall.\nError: disable socket fails", flags: &common.CommandSystemUninstallFlags{Force: false}, }, } diff --git a/internal/nonkube/bootstrap/uninstall.go b/internal/nonkube/bootstrap/uninstall.go index f09f56227..6398bc5e0 100644 --- a/internal/nonkube/bootstrap/uninstall.go +++ b/internal/nonkube/bootstrap/uninstall.go @@ -44,7 +44,7 @@ func Uninstall(platform string) error { cli, err := internalclient.NewCompatClient(endpoint, "") if err != nil { - return fmt.Errorf("failed to create container client: %v", err) + return fmt.Errorf("failed to create container client: %w", err) } container, err := cli.ContainerInspect(containerName)