mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
backend/remote: move reading policy check logs earlier
This commit is contained in:
parent
93906e1ad8
commit
105fcb3cac
@ -332,6 +332,14 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
|
|||||||
b.CLI.Output("\n------------------------------------------------------------------------\n")
|
b.CLI.Output("\n------------------------------------------------------------------------\n")
|
||||||
}
|
}
|
||||||
for i, pc := range r.PolicyChecks {
|
for i, pc := range r.PolicyChecks {
|
||||||
|
// Read the policy check logs. This is a blocking call that will only
|
||||||
|
// return once the policy check is complete.
|
||||||
|
logs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)
|
||||||
|
if err != nil {
|
||||||
|
return generalError("Failed to retrieve policy check logs", err)
|
||||||
|
}
|
||||||
|
reader := bufio.NewReaderSize(logs, 64*1024)
|
||||||
|
|
||||||
// Retrieve the policy check to get its current status.
|
// Retrieve the policy check to get its current status.
|
||||||
pc, err := b.client.PolicyChecks.Read(stopCtx, pc.ID)
|
pc, err := b.client.PolicyChecks.Read(stopCtx, pc.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -347,12 +355,6 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logs, err := b.client.PolicyChecks.Logs(stopCtx, pc.ID)
|
|
||||||
if err != nil {
|
|
||||||
return generalError("Failed to retrieve policy check logs", err)
|
|
||||||
}
|
|
||||||
reader := bufio.NewReaderSize(logs, 64*1024)
|
|
||||||
|
|
||||||
var msgPrefix string
|
var msgPrefix string
|
||||||
switch pc.Scope {
|
switch pc.Scope {
|
||||||
case tfe.PolicyScopeOrganization:
|
case tfe.PolicyScopeOrganization:
|
||||||
|
Loading…
Reference in New Issue
Block a user