Skip to content

Commit

Permalink
refactor(clean): update clean message
Browse files Browse the repository at this point in the history
update clean message

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Sep 12, 2023
1 parent d00d95a commit 0dc1d1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
6 changes: 5 additions & 1 deletion cmd/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ func CleanCommand(f factory.Factory) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
status, _ := confirm.Confirm("Are you sure to clean cluster")
if status {
return myCluster.Clean()
if err := myCluster.Clean(); err != nil {
return err
}
log.Donef("uninstall cluster success")
return nil
}
log.Donef("cancel clean cluster")
return nil
Expand Down
12 changes: 8 additions & 4 deletions cmd/quickon/quickon.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,21 @@ func UninstallCommand(f factory.Factory) *cobra.Command {
quickonClient := quickon.New(f)
uninstall := &cobra.Command{
Use: "uninstall",
Short: "uninstall quickon(devops)",
Short: "uninstall platform",
Aliases: []string{"clean"},
RunE: func(cmd *cobra.Command, args []string) error {
if err := quickonClient.GetKubeClient(); err != nil {
return err
}
status, _ := confirm.Confirm("Are you sure to uninstall quickon(devops)")
status, _ := confirm.Confirm("Are you sure to uninstall platform")
if status {
return quickonClient.UnInstall()
if err := quickonClient.UnInstall(); err != nil {
return err
}
log.Done("uninstall platform success")
return nil
}
log.Donef("cancel uninstall quickon(devops)")
log.Donef("cancel uninstall platform")
return nil
},
}
Expand Down
8 changes: 3 additions & 5 deletions cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ func newCmdUninstall(f factory.Factory) *cobra.Command {
Aliases: []string{"un", "clean"},
}
uninstallCmd.Run = func(cmd *cobra.Command, args []string) {
log.Debugf("start uninstall quickon")
if err := qcexec.CommandRun(globalToolPath, "quickon", "uninstall", fmt.Sprintf("--debug=%v", globalFlags.Debug)); err != nil {
log.Errorf("uninstall quickon failed, reason: %v", err)
log.Debugf("start uninstall platform")
if err := qcexec.CommandRun(globalToolPath, "platform", "uninstall", fmt.Sprintf("--debug=%v", globalFlags.Debug)); err != nil {
log.Errorf("uninstall platform failed, reason: %v", err)
return
}
log.Done("uninstall quickon success")
if cleanCluster {
// TODO 检查集群是否是quickon安装的
log.Debugf("start uninstall cluster")
if err := qcexec.CommandRun(globalToolPath, "cluster", "clean", fmt.Sprintf("--debug=%v", globalFlags.Debug)); err != nil {
log.Errorf("uninstall cluster failed, reason: %v", err)
return
}
log.Donef("uninstall cluster success")
}
log.Donef("uninstall success")
}
Expand Down

0 comments on commit 0dc1d1e

Please sign in to comment.