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:
parent
7022876494
commit
6da61bf07b
|
@ -345,9 +345,10 @@ func (c *InitCommand) getModules(path string, earlyRoot *tfconfig.Module, upgrad
|
||||||
|
|
||||||
installAbort, installDiags := c.installModules(path, upgrade, hooks)
|
installAbort, installDiags := c.installModules(path, upgrade, hooks)
|
||||||
diags = diags.Append(installDiags)
|
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
|
// Since module installer has modified the module manifest on disk, we need
|
||||||
// to refresh the cache of it in the loader.
|
// 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) {
|
func (c *InitCommand) initCloud(root *configs.Module) (be backend.Backend, output bool, diags tfdiags.Diagnostics) {
|
||||||
|
|
|
@ -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))
|
diags = diags.Append(fmt.Errorf("failed to create local modules directory: %s", err))
|
||||||
return true, diags
|
return true, diags
|
||||||
}
|
}
|
||||||
// FIXME: KEM: does returning the abort here change behaviour in a particular error
|
|
||||||
// case?
|
|
||||||
|
|
||||||
inst := m.moduleInstaller()
|
inst := m.moduleInstaller()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue