aboutsummaryrefslogtreecommitdiff
path: root/src/deployment.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-21 20:06:17 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-22 08:55:09 -0700
commitb63669ed5af088193d7e9ffe15d64840b50361ca (patch)
tree9bb277b171ebf8b4f597bcdbec0f2170627bd39d /src/deployment.lisp
parent57420310bcd4299ec4da463b9119012d6aa3dd3f (diff)
downloadconsfigurator-b63669ed5af088193d7e9ffe15d64840b50361ca.tar.gz
%CONSFIGURE: accept NIL for CONNECTIONS argument
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/deployment.lisp')
-rw-r--r--src/deployment.lisp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/deployment.lisp b/src/deployment.lisp
index ee006fb..0a200e3 100644
--- a/src/deployment.lisp
+++ b/src/deployment.lisp
@@ -26,8 +26,8 @@
Assumes arguments to connections in CONNECTIONS have been both normalised and
preprocessed."
(labels
- ((apply-propspec (propspec)
- (let ((propapp (eval-propspec propspec)))
+ ((apply-*host*-propspec ()
+ (let ((propapp (eval-propspec (host-propspec *host*))))
(assert-connection-supports (propapptype propapp))
(propappapply propapp)))
(connect (connections)
@@ -38,14 +38,18 @@ preprocessed."
(apply #'establish-connection type remaining args)))
(if remaining
(connect remaining)
- (apply-propspec (host-propspec *host*)))
+ (apply-*host*-propspec))
(connection-teardown *connection*)))))
(let ((*host* (preprocess-host host)))
- ;; prepend :LOCAL only if it's not already there and there is no
- ;; connection already established
- (connect (if (or *connection* (eq :local (caar connections)))
- connections
- (cons '(:local) connections))))))
+ (cond
+ ((and connections (or *connection* (eq :local (caar connections))))
+ (connect connections))
+ (connections
+ (connect (cons '(:local) connections)))
+ (*connection*
+ (apply-*host*-propspec))
+ (t
+ (connect '((:local))))))))
(defun deploy* (connections host &optional additional-properties)
"Execute the deployment which is defined by the pair (CONNECTIONS . HOST),
@@ -81,7 +85,7 @@ DEFHOST forms can override earlier entries (see DEFHOST's docstring)."
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 (or remaining-connections '((:local))) *host*))
+ (%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