revert change to installModules diag handling

Error diags from c.installModules() no longer cause getModules() to exit early.
Whether installModules completed successfully, errored, or was cancelled, we
try to update the manifest as best we can, preferring incomplete information
to none.
This commit is contained in:
Katy Moe 2021-11-09 13:15:13 +00:00
parent 7022876494
commit 6da61bf07b
No known key found for this signature in database
GPG Key ID: 8C3780F6DCDDA885
2 changed files with 5 additions and 6 deletions

View File

@ -345,9 +345,10 @@ func (c *InitCommand) getModules(path string, earlyRoot *tfconfig.Module, upgrad
installAbort, installDiags := c.installModules(path, upgrade, hooks)
diags = diags.Append(installDiags)
if installAbort || installDiags.HasErrors() {
return true, true, diags
}
// At this point, installModules may have generated error diags or been
// aborted by SIGINT. In any case we continue and the manifest as best
// we can.
// Since module installer has modified the module manifest on disk, we need
// to refresh the cache of it in the loader.
@ -362,7 +363,7 @@ func (c *InitCommand) getModules(path string, earlyRoot *tfconfig.Module, upgrad
}
}
return true, false, diags
return true, installAbort, diags
}
func (c *InitCommand) initCloud(root *configs.Module) (be backend.Backend, output bool, diags tfdiags.Diagnostics) {

View File

@ -178,8 +178,6 @@ func (m *Meta) installModules(rootDir string, upgrade bool, hooks initwd.ModuleI
diags = diags.Append(fmt.Errorf("failed to create local modules directory: %s", err))
return true, diags
}
// FIXME: KEM: does returning the abort here change behaviour in a particular error
// case?
inst := m.moduleInstaller()