Skip to content

Commit ee6382e

Browse files
committed
Clearify error message if user tries to uninstall a nonkube site.
1 parent 3869b96 commit ee6382e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

internal/cmd/skupper/system/nonkube/system_uninstall.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package nonkube
33
import (
44
"errors"
55
"fmt"
6+
"net"
67
"os"
78
"path"
89

@@ -99,7 +100,12 @@ func (cmd *CmdSystemUninstall) Run() error {
99100
err := cmd.SystemUninstall(string(config.GetPlatform()))
100101

101102
if err != nil {
102-
return fmt.Errorf("failed to uninstall : %s", err)
103+
opErr := &net.OpError{}
104+
if errors.As(err, &opErr) {
105+
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)
106+
} else {
107+
return fmt.Errorf("Unable to uninstall.\nError: %s", err.Error())
108+
}
103109
}
104110

105111
return nil

internal/cmd/skupper/system/nonkube/system_uninstall_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestCmdSystemUninstall_Run(t *testing.T) {
139139
{
140140
name: "disable socket fails",
141141
disableSocketFails: true,
142-
errorMessage: "failed to uninstall : disable socket fails",
142+
errorMessage: "Unable to uninstall.\nError: disable socket fails",
143143
flags: &common.CommandSystemUninstallFlags{Force: false},
144144
},
145145
}

internal/nonkube/bootstrap/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Uninstall(platform string) error {
4444

4545
cli, err := internalclient.NewCompatClient(endpoint, "")
4646
if err != nil {
47-
return fmt.Errorf("failed to create container client: %v", err)
47+
return fmt.Errorf("failed to create container client: %w", err)
4848
}
4949

5050
container, err := cli.ContainerInspect(containerName)

0 commit comments

Comments
 (0)