mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
7feef98517
Enough of the InstallModules method to install local modules (those with relative paths). "Install" is actually a bit of an exaggeration for these since we actually just record them in our manifest after verifying that the source directory exists. This is a change of behavior relative to the old module installer since we no longer create a symlink to the module directory inside the .terraform/modules directory. Instead, we record the module's true location in our manifest so that the loader will find it later. The use of a symlink here predated the manifest file. Now that we have a manifest file the symlinks are redundant. Using the "natural" location of the module leads to more helpful error messages, since we'll refer to the module path as the user expects it, rather than to an internal alias.
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package configload
|
|
|
|
import version "github.com/hashicorp/go-version"
|
|
|
|
// InstallHooks is an interface used to provide notifications about the
|
|
// installation process being orchestrated by InstallModules.
|
|
//
|
|
// This interface may have new methods added in future, so implementers should
|
|
// embed InstallHooksImpl to get no-op implementations of any unimplemented
|
|
// methods.
|
|
type InstallHooks interface {
|
|
// Download is called for modules that are retrieved from a remote source
|
|
// before that download begins, to allow a caller to give feedback
|
|
// on progress through a possibly-long sequence of downloads.
|
|
Download(moduleAddr, packageAddr string, version *version.Version)
|
|
|
|
// Install is called for each module that is installed, even if it did
|
|
// not need to be downloaded from a remote source.
|
|
Install(moduleAddr string, version *version.Version, localPath string)
|
|
}
|
|
|
|
// InstallHooksImpl is a do-nothing implementation of InstallHooks that
|
|
// can be embedded in another implementation struct to allow only partial
|
|
// implementation of the interface.
|
|
type InstallHooksImpl struct {
|
|
}
|
|
|
|
func (h InstallHooksImpl) Download(moduleAddr, packageAddr string, version *version.Version) {
|
|
}
|
|
|
|
func (h InstallHooksImpl) Install(moduleAddr string, version *version.Version, localPath string) {
|
|
}
|
|
|
|
var _ InstallHooks = InstallHooksImpl{}
|