mirror of https://github.com/docker/compose.git
Merge pull request #942 from docker/chore-remove-done
Remove useless Done in the progress writer
This commit is contained in:
commit
93490d5f4f
|
@ -129,12 +129,15 @@ func toProgressEvent(jm jsonmessage.JSONMessage, w progress.Writer) {
|
|||
if jm.Progress.Total != 0 {
|
||||
percentage := int(float64(jm.Progress.Current)/float64(jm.Progress.Total)*100) / 2
|
||||
numSpaces := 50 - percentage
|
||||
status := progress.Working
|
||||
if jm.Status == "Pull complete" {
|
||||
status = progress.Done
|
||||
}
|
||||
w.Event(progress.Event{
|
||||
ID: jm.ID,
|
||||
Text: jm.Status,
|
||||
Status: 0,
|
||||
Status: status,
|
||||
StatusText: fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces)),
|
||||
Done: jm.Status == "Pull complete",
|
||||
})
|
||||
} else {
|
||||
if jm.Error != nil {
|
||||
|
@ -143,21 +146,18 @@ func toProgressEvent(jm jsonmessage.JSONMessage, w progress.Writer) {
|
|||
Text: jm.Status,
|
||||
Status: progress.Error,
|
||||
StatusText: jm.Error.Message,
|
||||
Done: true,
|
||||
})
|
||||
} else if jm.Status == "Pull complete" || jm.Status == "Already exists" {
|
||||
w.Event(progress.Event{
|
||||
ID: jm.ID,
|
||||
Text: jm.Status,
|
||||
Status: progress.Done,
|
||||
Done: true,
|
||||
})
|
||||
} else {
|
||||
w.Event(progress.Event{
|
||||
ID: jm.ID,
|
||||
Text: jm.Status,
|
||||
Status: progress.Working,
|
||||
Done: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,6 @@ func (s *local) Down(ctx context.Context, projectName string) error {
|
|||
ID: getContainerName(container),
|
||||
Text: "Stopping",
|
||||
Status: progress.Working,
|
||||
Done: false,
|
||||
})
|
||||
err := s.containerService.Stop(ctx, container.ID, nil)
|
||||
if err != nil {
|
||||
|
@ -193,7 +192,6 @@ func (s *local) Down(ctx context.Context, projectName string) error {
|
|||
ID: getContainerName(container),
|
||||
Text: "Removing",
|
||||
Status: progress.Working,
|
||||
Done: false,
|
||||
})
|
||||
err = s.containerService.Delete(ctx, container.ID, containers.DeleteRequest{})
|
||||
if err != nil {
|
||||
|
@ -203,7 +201,6 @@ func (s *local) Down(ctx context.Context, projectName string) error {
|
|||
ID: getContainerName(container),
|
||||
Text: "Removed",
|
||||
Status: progress.Done,
|
||||
Done: true,
|
||||
})
|
||||
return nil
|
||||
})
|
||||
|
@ -623,7 +620,6 @@ func (s *local) ensureNetwork(ctx context.Context, n types.NetworkConfig) error
|
|||
ID: fmt.Sprintf("Network %q", n.Name),
|
||||
Status: progress.Working,
|
||||
StatusText: "Create",
|
||||
Done: false,
|
||||
})
|
||||
if _, err := s.containerService.apiClient.NetworkCreate(ctx, n.Name, createOpts); err != nil {
|
||||
return errors.Wrapf(err, "failed to create network %s", n.Name)
|
||||
|
@ -632,7 +628,6 @@ func (s *local) ensureNetwork(ctx context.Context, n types.NetworkConfig) error
|
|||
ID: fmt.Sprintf("Network %q", n.Name),
|
||||
Status: progress.Done,
|
||||
StatusText: "Created",
|
||||
Done: true,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
@ -651,7 +646,6 @@ func (s *local) ensureVolume(ctx context.Context, volume types.VolumeConfig) err
|
|||
ID: fmt.Sprintf("Volume %q", volume.Name),
|
||||
Status: progress.Working,
|
||||
StatusText: "Create",
|
||||
Done: false,
|
||||
})
|
||||
// TODO we miss support for driver_opts and labels
|
||||
_, err := s.volumeService.Create(ctx, volume.Name, nil)
|
||||
|
@ -659,7 +653,6 @@ func (s *local) ensureVolume(ctx context.Context, volume types.VolumeConfig) err
|
|||
ID: fmt.Sprintf("Volume %q", volume.Name),
|
||||
Status: progress.Done,
|
||||
StatusText: "Created",
|
||||
Done: true,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -169,7 +169,6 @@ func (s *local) createContainer(ctx context.Context, project *types.Project, ser
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Working,
|
||||
StatusText: "Create",
|
||||
Done: false,
|
||||
})
|
||||
err := s.runContainer(ctx, project, service, name, number, nil)
|
||||
if err != nil {
|
||||
|
@ -179,7 +178,6 @@ func (s *local) createContainer(ctx context.Context, project *types.Project, ser
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Done,
|
||||
StatusText: "Created",
|
||||
Done: true,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
@ -190,7 +188,6 @@ func (s *local) recreateContainer(ctx context.Context, project *types.Project, s
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Working,
|
||||
StatusText: "Recreate",
|
||||
Done: false,
|
||||
})
|
||||
err := s.containerService.Stop(ctx, container.ID, nil)
|
||||
if err != nil {
|
||||
|
@ -218,7 +215,6 @@ func (s *local) recreateContainer(ctx context.Context, project *types.Project, s
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Done,
|
||||
StatusText: "Recreated",
|
||||
Done: true,
|
||||
})
|
||||
setDependentLifecycle(project, service.Name, forceRecreate)
|
||||
return nil
|
||||
|
@ -243,7 +239,6 @@ func (s *local) restartContainer(ctx context.Context, service types.ServiceConfi
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Working,
|
||||
StatusText: "Restart",
|
||||
Done: false,
|
||||
})
|
||||
err := s.containerService.Start(ctx, container.ID)
|
||||
if err != nil {
|
||||
|
@ -253,7 +248,6 @@ func (s *local) restartContainer(ctx context.Context, service types.ServiceConfi
|
|||
ID: fmt.Sprintf("Service %q", service.Name),
|
||||
Status: progress.Done,
|
||||
StatusText: "Restarted",
|
||||
Done: true,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ type Event struct {
|
|||
Text string
|
||||
Status EventStatus
|
||||
StatusText string
|
||||
Done bool
|
||||
|
||||
startTime time.Time
|
||||
endTime time.Time
|
||||
|
|
Loading…
Reference in New Issue