Skip to content

Commit

Permalink
Fine-tuning create/delete of cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Dec 14, 2020
1 parent dac85e2 commit fac8975
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ func createChangeSetAndWait(sess *session.Session, stackInput *cloudformation.Cr

func createStackAndWait(sess *session.Session, stackInput *cloudformation.CreateStackInput) (*cloudformation.DescribeStacksOutput, error) {
cfnSvc := cloudformation.New(sess)
_, err := cfnSvc.CreateStack(stackInput)
stackOutput, err := cfnSvc.CreateStack(stackInput)
if err != nil {
return nil, err
}
Spinner.Suffix = fmt.Sprintf(" creating %s", aurora.Faint(stackOutput.StackId))
describeStacksInput := cloudformation.DescribeStacksInput{StackName: stackInput.StackName}
err = cfnSvc.WaitUntilStackCreateComplete(&describeStacksInput)
if err != nil {
Expand Down
8 changes: 2 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/logrusorgru/aurora"
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"

"github.com/briandowns/spinner"
Expand All @@ -30,16 +31,11 @@ const ()

var cfgFile string

func isTty() bool {
fileInfo, _ := os.Stdout.Stat()
return (fileInfo.Mode() & os.ModeCharDevice) != 0
}

// Spinner is the loading animation to use for all commands
var Spinner *spinner.Spinner = spinner.New(spinner.CharSets[14], 50*time.Millisecond)

func startSpinner() {
if isTty() {
if isatty.IsTerminal(os.Stdout.Fd()) {
Spinner.Start()
}
}
Expand Down

0 comments on commit fac8975

Please sign in to comment.