typos. some code, some text.
Signed-off-by: Paul Thrasher <pthrasher@hashicorp.com>
This commit is contained in:
parent
d2eaffabea
commit
4e308ef362
|
@ -254,10 +254,10 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
||||||
case <-time.After(500 * time.Millisecond):
|
case <-time.After(500 * time.Millisecond):
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the cost estimation to get its current status.
|
// Retrieve the cost estimate to get its current status.
|
||||||
ce, err := b.client.CostEstimates.Read(stopCtx, r.CostEstimate.ID)
|
ce, err := b.client.CostEstimates.Read(stopCtx, r.CostEstimate.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return generalError("Failed to retrieve cost estimation", err)
|
return generalError("Failed to retrieve cost estimate", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ce.Status {
|
switch ce.Status {
|
||||||
|
@ -284,8 +284,7 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
case tfe.CostEstimatePending:
|
case tfe.CostEstimatePending, tfe.CostEstimateQueued:
|
||||||
case tfe.CostEstimateQueued:
|
|
||||||
// Check if 30 seconds have passed since the last update.
|
// Check if 30 seconds have passed since the last update.
|
||||||
current := time.Now()
|
current := time.Now()
|
||||||
if b.CLI != nil && (i == 0 || current.Sub(updated).Seconds() > 30) {
|
if b.CLI != nil && (i == 0 || current.Sub(updated).Seconds() > 30) {
|
||||||
|
@ -297,7 +296,7 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
||||||
elapsed = fmt.Sprintf(
|
elapsed = fmt.Sprintf(
|
||||||
" (%s elapsed)", current.Sub(started).Truncate(30*time.Second))
|
" (%s elapsed)", current.Sub(started).Truncate(30*time.Second))
|
||||||
}
|
}
|
||||||
b.CLI.Output(b.Colorize().Color("Waiting for cost estimation to complete..." + elapsed + "\n"))
|
b.CLI.Output(b.Colorize().Color("Waiting for cost estimate to complete..." + elapsed + "\n"))
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
case tfe.CostEstimateErrored:
|
case tfe.CostEstimateErrored:
|
||||||
|
@ -305,7 +304,7 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
||||||
case tfe.CostEstimateCanceled:
|
case tfe.CostEstimateCanceled:
|
||||||
return fmt.Errorf(msgPrefix + " canceled.")
|
return fmt.Errorf(msgPrefix + " canceled.")
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Unknown or unexpected cost estimation state: %s", ce.Status)
|
return fmt.Errorf("Unknown or unexpected cost estimate state: %s", ce.Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue