summaryrefslogtreecommitdiff
path: root/modules.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-09-30 09:16:01 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-09-30 09:16:01 -0600
commit8eb2c3725199b17ae713dd0756a0e491e4829c12 (patch)
treed368a149518ed7247de4a2571e41aa7a6dbb38c7 /modules.go
parent1e662262179d326586d2beb849f842b82b7324c4 (diff)
Clean up provisioned modules on error; refactor Run(); add Validate()
Modules that return an error during provisioning should still be cleaned up so that they don't leak any resources they may have allocated before the error occurred. Cleanup should be able to run even if Provision does not complete fully.
Diffstat (limited to 'modules.go')
-rw-r--r--modules.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules.go b/modules.go
index 3ca5384..2d01eb3 100644
--- a/modules.go
+++ b/modules.go
@@ -253,9 +253,10 @@ type Validator interface {
// CleanerUpper is implemented by modules which may have side-effects
// such as opened files, spawned goroutines, or allocated some sort
-// of non-local state when they were provisioned. This method should
+// of non-stack state when they were provisioned. This method should
// deallocate/cleanup those resources to prevent memory leaks. Cleanup
-// should be fast and efficient.
+// should be fast and efficient. Cleanup should work even if Provision
+// returns an error, to allow cleaning up from partial provisionings.
type CleanerUpper interface {
Cleanup() error
}