From bc54aa417db93cecddcb3a35434e01730cbcb8cb Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Wed, 8 Mar 2017 09:31:18 -0800 Subject: [PATCH] spinner for waiting on CFN stacks --- common/stack.go | 7 +++++++ glide.lock | 6 ++++-- glide.yaml | 1 + workflows/environment_terminate.go | 2 +- workflows/pipeline_upsert.go | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/stack.go b/common/stack.go index a49ec0a2..dc668286 100644 --- a/common/stack.go +++ b/common/stack.go @@ -17,6 +17,7 @@ import ( "os" "strings" "time" + "github.com/briandowns/spinner" ) // CreateStackName will create a name for a stack @@ -241,6 +242,12 @@ func (cfnMgr *cloudformationStackManager) AwaitFinalStatus(stackName string) *St params := &cloudformation.DescribeStacksInput{ StackName: aws.String(stackName), } + + // initialize Spinner + spinner := spinner.New(spinner.CharSets[9], 100*time.Millisecond) + spinner.Start() + defer spinner.Stop() + resp, err := cfnAPI.DescribeStacks(params) if err == nil && resp != nil && len(resp.Stacks) == 1 { diff --git a/glide.lock b/glide.lock index 5997cdee..bfd183ca 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 406b1e1867f81e9a56bc2350ca8b9131e18156899926fe10ed089bca8880a90d -updated: 2017-03-07T16:26:20.60478348-08:00 +hash: f2f00c42cf0cfa225926e9ee5f96093eb52ca0f57075a31126315bf793e0c630 +updated: 2017-03-08T09:21:05.63735419-08:00 imports: - name: github.com/aws/aws-sdk-go version: 00fb2125993965df739fa3398b03bef3eb2e198f @@ -42,6 +42,8 @@ imports: - service/elbv2 - service/elbv2/elbv2iface - service/sts +- name: github.com/briandowns/spinner + version: 27dbbd67ecbfe572bbb1a79c2c6d62ad0cadde3c - name: github.com/docker/distribution version: fb0bebc4b64e3881cc52a2478d749845ed76d2a8 subpackages: diff --git a/glide.yaml b/glide.yaml index 66c21dca..4c4b3568 100644 --- a/glide.yaml +++ b/glide.yaml @@ -37,6 +37,7 @@ import: version: ~3.2.0 - package: github.com/tcnksm/go-gitconfig version: ~0.1.2 +- package: github.com/briandowns/spinner testImport: - package: github.com/stretchr/testify version: ~1.1.4 diff --git a/workflows/environment_terminate.go b/workflows/environment_terminate.go index d82d5fbf..f21daca6 100644 --- a/workflows/environment_terminate.go +++ b/workflows/environment_terminate.go @@ -36,7 +36,7 @@ func (workflow *environmentWorkflow) environmentServiceTerminator(environmentNam if stack.Tags["environment"] != environmentName { continue } - log.Infof(" Undeploying service '%s' from environment '%s'", stack.Tags["service"], environmentName ) + log.Infof(" Undeploying service '%s' from environment '%s'", stack.Tags["service"], environmentName) stackWaiter.AwaitFinalStatus(stack.Name) } diff --git a/workflows/pipeline_upsert.go b/workflows/pipeline_upsert.go index 7abd0680..e711433f 100644 --- a/workflows/pipeline_upsert.go +++ b/workflows/pipeline_upsert.go @@ -5,8 +5,8 @@ import ( "fmt" "github.com/stelligent/mu/common" "github.com/stelligent/mu/templates" - "strings" "regexp" + "strings" ) // NewPipelineUpserter create a new workflow for upserting a pipeline