aboutsummaryrefslogtreecommitdiff
path: root/src/deployment.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-28 17:56:23 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-28 17:56:23 -0700
commit84220cdb2c244f19db4e958187da51251be2ebdd (patch)
tree029fa0769ccdb146747cad24e9cffc69ebe41b48 /src/deployment.lisp
parent519c4dbd5a6ce576db4adf40c973b97c0d62b8c2 (diff)
downloadconsfigurator-84220cdb2c244f19db4e958187da51251be2ebdd.tar.gz
report whether FAILED-CHANGE, :NO-CHANGE or something else at end
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/deployment.lisp')
-rw-r--r--src/deployment.lisp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/deployment.lisp b/src/deployment.lisp
index fa79e81..348687a 100644
--- a/src/deployment.lisp
+++ b/src/deployment.lisp
@@ -71,6 +71,23 @@ will not be discarded."
:propspec (with-*host*-*consfig*
(make-propspec :propspec propspec-expression)))))
+(defmacro with-deployment-report (&rest forms)
+ (with-gensyms (failures)
+ `(let (,failures)
+ (handler-bind
+ ((failed-change (lambda (c) (setq ,failures t) (signal c))))
+ (let ((result (progn ,@forms)))
+ (inform
+ t
+ (cond
+ ((eql :no-change result)
+ "No changes were made.")
+ (,failures
+ "There were failures while attempting to apply some properties.")
+ (t
+ "Changes were made without any reported failures.")))
+ result)))))
+
(defun deploy* (connections host &optional additional-properties)
"Execute the deployment which is defined by the pair (CONNECTIONS . HOST),
except possibly with the property application specification
@@ -80,8 +97,9 @@ This is the entry point to Consfigurator's primary loop. Typically users use
DEPLOY, DEPLOY-THESE, and the function definitions established by DEFDEPLOY,
DEFDEPLOY-THESE, etc., rather than calling this function directly. However,
code which programmatically constructs deployments will need to call this."
- (%consfigure (preprocess-connections connections)
- (union-propspec-into-host host additional-properties)))
+ (with-deployment-report
+ (%consfigure (preprocess-connections connections)
+ (union-propspec-into-host host additional-properties))))
(defun deploy-these* (connections host properties)
"Like DEPLOY*, but replace the properties of HOST with PROPERTIES.
@@ -91,8 +109,9 @@ properties, plus any set by PROPERTIES. Static informational attributes set
by PROPERTIES can override the host's usual static informational attributes,
in the same way that later entries in the list of properties specified in
DEFHOST forms can override earlier entries (see DEFHOST's docstring)."
- (%consfigure (preprocess-connections connections)
- (replace-propspec-into-host host properties)))
+ (with-deployment-report
+ (%consfigure (preprocess-connections connections)
+ (replace-propspec-into-host host properties))))
(defun continue-deploy* (connection remaining-connections)
"Complete the work of an enclosing call to DEPLOY* or DEPLOY-THESE*.