aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-01 13:00:45 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-01 14:47:27 -0700
commit27d73167ae319284d83d6c48baf23e834e8dfe0c (patch)
treeeb5a1496e50ba3a34d3f808f695c6b5124c7fa20 /src
parent9b67a83b16c200ebea3dca8984867f2c92ceda92 (diff)
downloadconsfigurator-27d73167ae319284d83d6c48baf23e834e8dfe0c.tar.gz
replace DEFHOSTDEPLOY
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r--src/deployment.lisp20
-rw-r--r--src/host.lisp12
-rw-r--r--src/package.lisp1
3 files changed, 10 insertions, 23 deletions
diff --git a/src/deployment.lisp b/src/deployment.lisp
index c2cd7e4..9cb862b 100644
--- a/src/deployment.lisp
+++ b/src/deployment.lisp
@@ -126,26 +126,6 @@ You can then eval (NAME) to execute this deployment."
`(defun ,name ()
(deploy-these ,connections ,host ,@properties)))
-;; TODO some useful combination of DEFHOST and DEFHOSTDEPLOY so that you don't
-;; have to use two forms to specify the default connection type. Probably
-;; want argument order to be similar to DEPLOY, DEPLOY-THESE etc.
-(defmacro defhostdeploy (connection host-name)
- "Where HOST-NAME names a host as defined with DEFHOST, define a function
-which does (deploy CONNECTION (symbol-value HOST)).
-You can then eval (HOST-NAME) to execute this deployment.
-
-For example, if you usually deploy properties to athena by SSH,
-
- (defhost athena.silentflame.com
- (foo)
- (bar)
- ...)
-
- (defhostdeploy :ssh athena.silentflame.com)
-
-and then you can eval (athena.silentflame.com) to apply athena's properties."
- `(defdeploy ,host-name (,connection ,host-name)))
-
(defprop deploys :posix (connections host &optional additional-properties)
"Execute the deployment which is defined by the pair (CONNECTIONS . HOST),
except possibly with the property application specification
diff --git a/src/host.lisp b/src/host.lisp
index 1f2c22a..f948ec8 100644
--- a/src/host.lisp
+++ b/src/host.lisp
@@ -40,12 +40,18 @@ be applied to the host.")))
:props ,(slot-value host 'propspec)))
host)
-(defmacro defhost (hostname &body properties)
+(defmacro defhost (hostname (&key deploy) &body properties)
"Define a host with hostname HOSTNAME and properties PROPERTIES.
HOSTNAME can be a string or a symbol. In either case, the host will get a
static informational property with its hostname as a string, and the symbol
whose name is the hostname will be bound to the host object.
+DEPLOY represents the usual way you'll connect to the host to deploy
+properties, and if specified, a function named HOSTNAME will be defined to
+deploy the host using that connection chain. This is an optional convenience
+feature; you can always use DEPLOY and DEPLOY-THESE to apply properties to the
+host using an arbitrary chain of connections.
+
If the first entry in PROPERTIES is a string, it will be considered a
human-readable description of the host. Otherwise, PROPERTIES is an
unevaluated property application specification. Recall that for atomic
@@ -72,4 +78,6 @@ entries."
(defparameter ,hostname-sym
(%replace-propspec-into-host (make-instance 'host :attrs ',attrs)
,(props properties))
- ,(car (getf attrs :desc))))))
+ ,(car (getf attrs :desc)))
+ ,@(when deploy
+ `((defdeploy ,hostname-sym (,deploy ,hostname-sym)))))))
diff --git a/src/package.lisp b/src/package.lisp
index 0955391..8496124 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -98,7 +98,6 @@
;; deployment.lisp
#:defdeploy
#:defdeploy-these
- #:defhostdeploy
#:deploy
#:deploy*
#:deploys