mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Code Improvements:
- Use tfe consts instead of hardcoded values - fix logic when polling taskStage - remove inaccurate comment
This commit is contained in:
parent
5c5b1099c8
commit
15288caf64
@ -62,18 +62,18 @@ func (trs *taskResultSummarizer) Summarize(context *IntegrationContext, output I
|
||||
func summarizeTaskResults(taskResults []*tfe.TaskResult) *taskResultSummary {
|
||||
var pendingCount, errCount, errMandatoryCount, passedCount int
|
||||
for _, task := range taskResults {
|
||||
if task.Status == "unreachable" {
|
||||
if task.Status == tfe.TaskUnreachable {
|
||||
return &taskResultSummary{
|
||||
unreachable: true,
|
||||
}
|
||||
} else if task.Status == "running" || task.Status == "pending" {
|
||||
} else if task.Status == tfe.TaskRunning || task.Status == tfe.TaskPending {
|
||||
pendingCount++
|
||||
} else if task.Status == "passed" {
|
||||
} else if task.Status == tfe.TaskPassed {
|
||||
passedCount++
|
||||
} else {
|
||||
// Everything else is a failure
|
||||
errCount++
|
||||
if task.WorkspaceTaskEnforcementLevel == "mandatory" {
|
||||
if task.WorkspaceTaskEnforcementLevel == tfe.Mandatory {
|
||||
errMandatoryCount++
|
||||
}
|
||||
}
|
||||
|
@ -89,11 +89,10 @@ func (b *Cloud) runTaskStage(ctx *IntegrationContext, output IntegrationOutputWr
|
||||
break
|
||||
}
|
||||
if !cont {
|
||||
continue
|
||||
return false, nil
|
||||
}
|
||||
// cont is true and we must continue to poll
|
||||
if msg != nil {
|
||||
// print msg every 4 seconds
|
||||
if i%4 == 0 && i > 0 {
|
||||
output.OutputElapsed(*msg, len(*msg)) // Up to 2 digits are allowed by the max message allocation
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user