diff options
author | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2023-07-10 18:47:19 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers+gitlab@digital-scurf.org> | 2023-07-10 18:47:19 +0000 |
commit | 38e985bb506235832d2de358fe93834139f2db30 (patch) | |
tree | f31d0ebaf92dd6540cd577e95b2f5c7e6432c92d /subplot.md | |
parent | 7a11efdf232d01ad5df1dab44514ed7481e5f346 (diff) | |
parent | 4a35ec5e00807e93408bd0e5cdc85e8e89db4904 (diff) | |
download | subplot-38e985bb506235832d2de358fe93834139f2db30.tar.gz |
Merge branch 'liw/atomic-function' into 'main'
docs: make it clear that cleanups are call only on successful steps
Closes #261
See merge request subplot/subplot!344
Diffstat (limited to 'subplot.md')
-rw-r--r-- | subplot.md | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -687,6 +687,24 @@ implementation functions: * A binding for a "then everything is OK" step, which captures nothing, and calls the `check_everything_is_ok` function. +## Step functions and cleanup + +A step function must be atomic: either it completes successfully, or +it cleans up any changes it made before returning an indication of +failure. + +A cleanup function is only called for successfully executed step +functions. + +For example, consider a step that creates and starts a virtual +machine. The step function creates the VM, then starts it, and if both +actions succeeds, the step succeeds. A cleanup function for that step +will stop and delete the VM. The cleanup is only called if the step +succeeded. If the step function manages to create the VM, but not +start it, it's the step function's responsibility to delete the VM, +before it signals failure. The cleanup function won't be called in +that case. + ### Simple patterns The simple patterns are of the form `{name}` and match a single word |