diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-09-05 14:30:10 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-10-23 10:51:30 -0700 |
commit | 9f283262438bb0656870648f5a2f7bedae4d1030 (patch) | |
tree | 77e8cc6cc36b49800cf799aac95d25a426b6326f /src/property.lisp | |
parent | 80b5cb9cea4a4d56455661678d896514312109eb (diff) | |
download | consfigurator-9f283262438bb0656870648f5a2f7bedae4d1030.tar.gz |
add SKIP-SEQUENCE, ABORTED-CHANGE, ESEQPROPS-UNTIL
We establish a SKIP-PROPERTY restart for each sequencing combinator, such that
in addition to skipping over individual property applications, it is possible
to abandon the whole sequence. However, that restart discards information
about whether or not a change was made by the property applications of the
abandoned sequence prior to the property application interrupted by an error.
The new SKIP-SEQUENCE restart preserves this information by returning from the
DOLIST in APPLY-AND-PRINT.
The implementation of the SKIP-SEQUENCE restart must take into account the
fact that the property application interrupted by the error might have made a
change prior to failing. In particular, the new restart must not cause the
sequencing combinator to return :NO-CHANGE unless it can infer that the
property application interrupted by an error made no change. To achieve this,
capture whether the interrupted property application made a change by
introducing a distinction between plain FAILED-CHANGE and a new condition
class, ABORTED-CHANGE.
These changes permit the implementation of a new combinator, ESEQPROPS-UNTIL,
which invokes SKIP-SEQUENCE when a given condition is signalled. The new
combinator is like SEQPROPS in that it allows for continuing the deployment
despite a signalling of FAILED-CHANGE, but it is like ESEQPROPS in not
attempting to apply succeeding propapps. It also offers finer-grained control
over what kinds of failures are to be tolerated than does SEQPROPS. When the
condition is ABORTED-CHANGE or a subclass, ESEQPROPS-UNTIL returns information
about whether or not a change was made by the property applications of the
abandoned sequence prior to the property application that was interrupted,
enabling useful combinations with ON-CHANGE.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property.lisp')
-rw-r--r-- | src/property.lisp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/property.lisp b/src/property.lisp index b43fe8c..660a23e 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -473,7 +473,7 @@ other than constant values and propapps to property combinators." ;;;; hostattrs in property subroutines -(define-simple-error inapplicable-property +(define-simple-error inapplicable-property () "Signal, in a :HOSTATTRS subroutine, that the host's hostattrs indicate that this property cannot be applied to this host. E.g. the property will try to install an apt package but the host is FreeBSD.") @@ -553,10 +553,18 @@ Called by property subroutines." ;;;; :APPLY subroutines -(define-simple-error failed-change +(define-simple-error failed-change () "Signal problems with the connection and errors while actually attempting to apply or unapply properties.") +(define-simple-error aborted-change (failed-change) + "Like FAILED-CHANGE, except the attempt to apply or unapply the property has +failed before any changes have been made to the system. Signalled when a +property is able to determine that it cannot be applied/unapplied by examining +the actual state of the host but without making any changes. + +Not to be confused with INAPPLICABLE-PROPERTY.") + (defun maybe-writefile-string (path content &key (mode nil mode-supplied-p)) "Wrapper around WRITEFILE which returns :NO-CHANGE and avoids writing PATH if PATH already has the specified CONTENT and MODE." |