aboutsummaryrefslogtreecommitdiff
path: root/src/deployment.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-24 13:47:12 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-24 13:47:39 -0700
commitcd39d1fa08f0811e3361aca4a0fc1f0cd8ce7b2f (patch)
tree1f848d1d844526278ec7410795756a31d5cd2adb /src/deployment.lisp
parent3eda6d0f63bb2b19182dfbacfaa9dd656286d740 (diff)
downloadconsfigurator-cd39d1fa08f0811e3361aca4a0fc1f0cd8ce7b2f.tar.gz
make dedicated RECONNECTS property rather than using DEPLOYS-THESE
This is easier to read. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/deployment.lisp')
-rw-r--r--src/deployment.lisp45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/deployment.lisp b/src/deployment.lisp
index 34393c2..3414aa2 100644
--- a/src/deployment.lisp
+++ b/src/deployment.lisp
@@ -188,30 +188,37 @@ Also useful to set up VMs, chroots, disk images etc. on localhost."
(defprop deploys-these :posix (connections host &optional properties)
"Like DEPLOYS, except apply to HOST each of the properties specified by
PROPERTIES, and not the host's usual properties, unless they also appear in
-PROPERTIES, like DEPLOY-THESE.
-
-As a special case, if HOST is :PARENT, use the host to which this property is
-being applied. This is useful to apply properties to the host with a
-different connection type; for example, by switching to another user account
-with the :AS connection type. Note that any new hostattrs set by PROPERTIES
-will not affect the rest of the deployment, except requests for items of
-prerequisite data to be supplied."
+PROPERTIES, like DEPLOY-THESE."
(:preprocess
(list (preprocess-connections connections)
- (list :host host)
- properties))
- (:hostattrs
- (declare (ignore connections))
- (setf (getf host :host)
(preprocess-host
- (if (eql :parent (getf host :host))
- (make-host :hostattrs (copy-list (hostattrs *host*))
- :propspec properties)
- (shallow-copy-host (getf host :host)))))
- (%propagate-hostattrs (getf host :host)))
+ (%replace-propspec-into-host (shallow-copy-host host) properties))))
+ (:hostattrs
+ (declare (ignore connections properties))
+ (%propagate-hostattrs host))
(:apply
(declare (ignore properties))
- (%consfigure connections (getf host :host))))
+ (%consfigure connections host)))
+
+(defprop reconnects :posix (connections properties)
+ "Connect back to the same host with CONNECTIONS and apply PROPERTIES.
+Mainly useful for using a connection type like :AS to apply properties as a
+different user."
+ (:preprocess
+ (list (preprocess-connections connections)
+ (preprocess-propspec properties)))
+ (:hostattrs
+ (declare (ignore connections))
+ (dolist (system (propspec-systems properties))
+ (pushnew system (slot-value (host-propspec *host*) 'systems)))
+ (propappattrs (eval-propspec properties)))
+ (:apply
+ ;; we don't COPY-LIST *HOST*'s hostattrs here only because we know
+ ;; %CONSFIGURE is about to do just that
+ (%consfigure connections
+ (make-instance
+ 'preprocessed-host
+ :hostattrs (hostattrs *host*) :propspec properties))))
(defun preprocess-connections (connections)
(loop for connection in (ensure-cons connections)