mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-03 18:04:28 -05:00
Add spinner interrrupt for rollback
This commit is contained in:
parent
75439344c9
commit
10004875f4
9 changed files with 119 additions and 56 deletions
|
|
@ -36,19 +36,21 @@ func NewTerminateCmd() *cobra.Command {
|
|||
// runTerminate runs the terminate command.
|
||||
func runTerminate(cmd *cobra.Command, args []string) error {
|
||||
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||
spinner, _ := newSpinner(cmd, cmd.OutOrStdout())
|
||||
defer spinner.Stop()
|
||||
terminator := cloudcmd.NewTerminator()
|
||||
|
||||
return terminate(cmd, terminator, fileHandler)
|
||||
return terminate(cmd, terminator, fileHandler, spinner)
|
||||
}
|
||||
|
||||
func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.Handler) error {
|
||||
func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.Handler, spinner spinnerInterf,
|
||||
) error {
|
||||
var stat state.ConstellationState
|
||||
if err := fileHandler.ReadJSON(constants.StateFilename, &stat); err != nil {
|
||||
return fmt.Errorf("reading Constellation state: %w", err)
|
||||
}
|
||||
|
||||
spinner := newSpinner(cmd, "Terminating", false)
|
||||
spinner.Start()
|
||||
spinner.Start("Terminating", false)
|
||||
err := terminator.Terminate(cmd.Context(), stat)
|
||||
spinner.Stop()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue