Skip to content

Commit

Permalink
Removing non-existing cluster via configuration
Browse files Browse the repository at this point in the history
Signed-off-by: kuritka <[email protected]>
  • Loading branch information
kuritka authored and iwilltry42 committed Dec 12, 2021
1 parent a82731f commit 4ffc71d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/cluster/clusterDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ THE SOFTWARE.
package cluster

import (
"errors"
"fmt"
"os"
"path"
Expand Down Expand Up @@ -131,8 +132,9 @@ func parseDeleteClusterCmd(cmd *cobra.Command, args []string) []*k3d.Cluster {
}

c, err := client.ClusterGet(cmd.Context(), runtimes.SelectedRuntime, &k3d.Cluster{Name: clusterDeleteCfgViper.GetString("name")})
if err != nil {
l.Log().Fatalf("failed to delete cluster '%s': %v", clusterDeleteCfgViper.GetString("name"), err)
if errors.Is(err, client.ClusterGetNoNodesFoundError) {
l.Log().Infof("No nodes found for cluster '%s', nothing to delete.", clusterDeleteCfgViper.GetString("name"))
return nil
}

clusters = append(clusters, c)
Expand Down

0 comments on commit 4ffc71d

Please sign in to comment.