diff --git a/ecs/cmd/commands/compose.go b/ecs/cmd/commands/compose.go index c0ed60093..7fea85e94 100644 --- a/ecs/cmd/commands/compose.go +++ b/ecs/cmd/commands/compose.go @@ -82,7 +82,6 @@ func UpCommand(dockerCli command.Cli, options *composeOptions) *cobra.Command { } return progress.Run(context.Background(), func(ctx context.Context) error { - backend.SetWriter(ctx) return backend.Up(ctx, opts) }) }), @@ -130,7 +129,6 @@ func DownCommand(dockerCli command.Cli, options *composeOptions) *cobra.Command return err } return progress.Run(context.Background(), func(ctx context.Context) error { - backend.SetWriter(ctx) return backend.Down(ctx, opts) }) }), diff --git a/ecs/pkg/amazon/backend/backend.go b/ecs/pkg/amazon/backend/backend.go index caf7e17de..2b265f3e2 100644 --- a/ecs/pkg/amazon/backend/backend.go +++ b/ecs/pkg/amazon/backend/backend.go @@ -1,12 +1,9 @@ package backend import ( - "context" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/docker/ecs-plugin/pkg/amazon/sdk" - "github.com/docker/ecs-plugin/pkg/progress" ) func NewBackend(profile string, region string) (*Backend, error) { @@ -30,9 +27,4 @@ func NewBackend(profile string, region string) (*Backend, error) { type Backend struct { Region string api sdk.API - writer progress.Writer -} - -func (b *Backend) SetWriter(context context.Context) { - b.writer = progress.ContextWriter(context) } diff --git a/ecs/pkg/amazon/backend/wait.go b/ecs/pkg/amazon/backend/wait.go index 82b9863b0..dcc26772c 100644 --- a/ecs/pkg/amazon/backend/wait.go +++ b/ecs/pkg/amazon/backend/wait.go @@ -14,7 +14,8 @@ import ( func (b *Backend) WaitStackCompletion(ctx context.Context, name string, operation int) error { knownEvents := map[string]struct{}{} - + // progress writer + w := progress.ContextWriter(ctx) // Get the unique Stack ID so we can collect events without getting some from previous deployments with same name stackID, err := b.api.GetStackID(ctx, name) if err != nil { @@ -80,7 +81,7 @@ func (b *Backend) WaitStackCompletion(ctx context.Context, name string, operatio } } } - b.writer.Event(progress.Event{ + w.Event(progress.Event{ ID: resource, Status: progressStatus, StatusText: status,