aboutsummaryrefslogtreecommitdiff
path: root/src/deployment.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-16 18:27:08 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-18 09:55:57 -0700
commit4712c48258af595cbda4207a57edb3fce75f6d0a (patch)
treea645da0ce9a54b448d1b61b9b2321d09051eb642 /src/deployment.lisp
parentb2707494cd338a0d1b889921f0095399d8de42e6 (diff)
downloadconsfigurator-4712c48258af595cbda4207a57edb3fce75f6d0a.tar.gz
enable retrieving existing hostattrs in DEPLOY and DEPLOY-THESE
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/deployment.lisp')
-rw-r--r--src/deployment.lisp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/deployment.lisp b/src/deployment.lisp
index 54dc2c6..5dbafbb 100644
--- a/src/deployment.lisp
+++ b/src/deployment.lisp
@@ -76,6 +76,11 @@ Used by implementations of ESTABLISH-CONNECTION which need to do something
like fork(2) and then return to Consfigurator's primary loop in the child."
(%consfigure remaining-connections *host*))
+;; in the following two macros, bind *HOST* so that evaluation of the
+;; unevaluated propspec can retrieve existing hostattrs; shallow copy just in
+;; case the evaluation of the arguments to propapps in the unevaluated
+;; propspec sets any new hostattrs, even though it's not meant to
+
(defmacro deploy (connections host &body additional-properties)
"Establish CONNECTIONS to HOST, and apply each of the host's usual
properties, followed by specified by ADDITIONAL-PROPERTIES, an unevaluated
@@ -90,8 +95,17 @@ ADDITIONAL-PROPERTIES. Static informational attributes set by
ADDITIONAL-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)."
- `(deploy* ',connections ,host (props eseqprops ,@additional-properties)))
+docstring).
+
+The evaluation of ADDITIONAL-PROPERTIES to produce a property application
+specification may retrieve existing hostattrs, but should not set any new
+ones (not to be confused with how the :HOSTATTRS subroutines of properties in
+ADDITIONAL-PROPERTIES may set additional hostattrs)."
+ (once-only (host)
+ `(deploy* ',connections
+ ,host
+ (let ((*host* (shallow-copy-host ,host)))
+ (props eseqprops ,@additional-properties)))))
(defmacro deploy-these (connections host &body properties)
"Like DEPLOY, except apply each of the properties specified by PROPERTIES,
@@ -109,8 +123,17 @@ HOST has all its usual static informational attributes, as set by its usual
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)."
- `(deploy-these* ',connections ,host (props eseqprops ,@properties)))
+DEFHOST forms can override earlier entries (see DEFHOST's docstring).
+
+The evaluation of PROPERTIES to produce a property application specification
+may retrieve existing hostattrs, but should not set any new ones (not to be
+confused with how the :HOSTATTRS subroutines of properties in PROPERTIES may
+set additional hostattrs)."
+ (once-only (host)
+ `(deploy-these* ',connections
+ ,host
+ (let ((*host* (shallow-copy-host ,host)))
+ (props eseqprops ,@properties)))))
(defmacro defdeploy (name (connections host) &body additional-properties)
"Define a function which does (DEPLOY CONNECTIONS HOST ADDITIONAL-PROPERTIES).