mirror of https://github.com/docker/compose.git
Merge pull request #818 from docker/ecs_event_status
Remove status truncate on wait
This commit is contained in:
commit
d5ed2bdecf
13
ecs/wait.go
13
ecs/wait.go
|
@ -74,8 +74,7 @@ func (b *ecsAPIService) WaitStackCompletion(ctx context.Context, name string, op
|
|||
knownEvents[*event.EventId] = struct{}{}
|
||||
|
||||
resource := aws.StringValue(event.LogicalResourceId)
|
||||
reason := shortenMessage(
|
||||
aws.StringValue(event.ResourceStatusReason))
|
||||
reason := aws.StringValue(event.ResourceStatusReason)
|
||||
status := aws.StringValue(event.ResourceStatus)
|
||||
progressStatus := progress.Working
|
||||
|
||||
|
@ -116,21 +115,13 @@ func (b *ecsAPIService) WaitStackCompletion(ctx context.Context, name string, op
|
|||
}
|
||||
stackErr = err
|
||||
operation = stackDelete
|
||||
reason := shortenMessage(err.Error())
|
||||
w.Event(progress.Event{
|
||||
ID: name,
|
||||
Status: progress.Error,
|
||||
StatusText: reason,
|
||||
StatusText: err.Error(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return stackErr
|
||||
}
|
||||
|
||||
func shortenMessage(message string) string {
|
||||
if len(message) < 30 {
|
||||
return message
|
||||
}
|
||||
return message[:30] + "..."
|
||||
}
|
||||
|
|
|
@ -146,12 +146,19 @@ func lineText(event Event, terminalWidth, statusPadding int, color bool) string
|
|||
if padding < 0 {
|
||||
padding = 0
|
||||
}
|
||||
// calculate the max length for the status text, on errors it
|
||||
// is 2-3 lines long and breaks the line formating
|
||||
maxStatusLen := terminalWidth - textLen - statusPadding - 15
|
||||
status := event.StatusText
|
||||
if len(status) > maxStatusLen {
|
||||
status = status[:maxStatusLen] + "..."
|
||||
}
|
||||
text := fmt.Sprintf(" %s %s %s%s %s",
|
||||
event.spinner.String(),
|
||||
event.ID,
|
||||
event.Text,
|
||||
strings.Repeat(" ", padding),
|
||||
event.StatusText,
|
||||
status,
|
||||
)
|
||||
timer := fmt.Sprintf("%.1fs\n", elapsed)
|
||||
o := align(text, timer, terminalWidth)
|
||||
|
|
Loading…
Reference in New Issue