mirror of https://github.com/docker/compose.git
Init progress writer in WaitStackCompletion
Signed-off-by: aiordache <anca.iordache@docker.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
f74cc8f0aa
commit
9eb0a10517
|
@ -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)
|
||||
})
|
||||
}),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue