Skip to content

Commit

Permalink
feat: purge error fixed and isBootstrapped fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryakoste committed Jun 18, 2024
1 parent 68ce435 commit a7b859f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions cmd/glasskube/cmd/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ var purgeCmd = &cobra.Command{
bold := color.New(color.Bold).SprintFunc()
currentContext := clicontext.RawConfigFromContext(ctx).CurrentContext

isBootstrapped, err := bootstrap.IsBootstrapped(cmd.Context(), cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
cliutils.ExitWithError()
}
if !isBootstrapped {
fmt.Fprintln(os.Stderr, "error: glasskube is not bootstrapped")
cliutils.ExitWithError()
}

if !purgeCmdOptions.yes {
confirmMessage := fmt.Sprintf("⚠️ Glasskube and all related resources will be purged from context %s."+
"\nThis includes removal of all installed packages!\nContinue? ", bold(currentContext))
Expand All @@ -48,12 +58,6 @@ var purgeCmd = &cobra.Command{
}
}

IsBootstrapped, err := bootstrap.IsBootstrapped(cmd.Context(), cfg)
if err != nil && !IsBootstrapped {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
cliutils.ExitWithError()
}

if err := client.Purge(ctx); err != nil {
fmt.Fprintf(os.Stderr, "\nAn error occurred during purge:\n%v\n", err)
cliutils.ExitWithError()
Expand Down
2 changes: 1 addition & 1 deletion pkg/purge/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c *Purger) Purge(ctx context.Context) error {
fmt.Fprintf(os.Stderr, "Failed to check package operator version: %v\n", err)
}

manifestUrl := fmt.Sprintf("https://github.com/glasskube/glasskube/releases/download/v%v/manifest-%s.yaml",
manifestUrl := fmt.Sprintf("https://github.com/glasskube/glasskube/releases/download/%v/manifest-%s.yaml",
operatorVersion, "slim")

c.status.SetStatus("Fetching Glasskube manifest from " + manifestUrl)
Expand Down

0 comments on commit a7b859f

Please sign in to comment.