aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst4
-rw-r--r--src/deployment.lisp20
-rw-r--r--src/host.lisp12
-rw-r--r--src/package.lisp1
4 files changed, 11 insertions, 26 deletions
diff --git a/README.rst b/README.rst
index 1b4dac5..9baefa2 100644
--- a/README.rst
+++ b/README.rst
@@ -105,13 +105,11 @@ Try it out / quick start
:pgp :location #P"/path/to/com.example.consfig.gpg")
(defhost athena.example.com
+ (:deploy (:ssh (:sudo :as "spwhitton@athena.example.com") :debian-sbcl))
"Web and file server."
(file:has-content "/etc/foo" '("these" "are" "my" "lines"))
(file:contains-lines "/etc/some.conf" '("FOO=bar")))
- (defhostdeploy (:ssh (:sudo :as "spwhitton@athena.example.com") :debian-sbcl)
- athena.example.com)
-
Here, "spwhitton" is my username on athena; we have to tell Consfigurator
what user it will be when it tries to sudo, so it knows whose password it
needs. If you have passwordless sudo access configured, you can skip the
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