diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-02 13:06:57 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-06 12:23:51 -0700 |
commit | 41b04c179964b7cc6a83e6749c436b3ba6cb0d39 (patch) | |
tree | 97216f221effbaea3ca1762cc0b2fcdf0b8efe25 /src | |
parent | 0f9b6517daad070a144baae9925f12b15fec3ff7 (diff) | |
download | consfigurator-41b04c179964b7cc6a83e6749c436b3ba6cb0d39.tar.gz |
replace WITH-LOCAL-... with an EVALS property
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.lisp | 16 | ||||
-rw-r--r-- | src/deployment.lisp | 17 | ||||
-rw-r--r-- | src/package.lisp | 3 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index 0ebe348..487559d 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -436,22 +436,6 @@ PATH may be any kind of file, including directories." (mrun :may-fail #?"chown ${uid}:${gid} ${namestring}"))))) (connection-writefile *connection* namestring content mode))) -(defmacro with-local-connection (&body forms) - "Execute FORMS as though a :LOCAL connection had been established. -This is for testing purposes at the REPL and in Consfigurator's test suite. -FORMS is typically the programmatic application of one or more properties." - `(let ((*host* (make-host :propspec (make-propspec :systems nil))) - (*connection* (establish-connection :local nil))) - ,@forms)) - -(defmacro with-local-passwordless-sudo-connection (&body forms) - "Execute FORMS as though a passwordless :SUDO connection to localhost had been -established. Occasionally useful for testing purposes at the REPL." - `(with-local-connection - (let ((*connection* (establish-connection :sudo nil - :user "root" :password nil))) - ,@forms))) - ;;;; Connection attributes diff --git a/src/deployment.lisp b/src/deployment.lisp index 104a810..0703c37 100644 --- a/src/deployment.lisp +++ b/src/deployment.lisp @@ -271,3 +271,20 @@ different user." (pushnew system (slot-value (host-propspec *host*) 'systems))) (dolist (attr (getf (hostattrs host) :data)) (push-hostattrs :data attr))) + +(defprop evals :posix (&rest forms) + "Property which just evaluates each of FORMS using EVAL. Only for testing +newly defined functions and programmatic applications of properties at the +REPL with DEPLOY-THESE/HOSTDEPLOY-THESE -- do not add to hosts. + +For example, to sudo to root to test your new function which needs root +privileges to do anything at all, + + (deploy-these :sudo melete.silentflame.com (evals '(my-new-function))) + +where melete.silentflame.com is your laptop. + +Note that while this property is declared to be :POSIX for flexibility, +whether it is actually :POSIX depends on what input and output FORMS perform." + (:desc (format nil "Evaluated ~{~S~^ ~}" forms)) + (:apply (eval `(progn ,@forms)))) diff --git a/src/package.lisp b/src/package.lisp index 5dd7420..9d69cf3 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -112,8 +112,6 @@ #:delete-remote-trees #:readfile #:writefile - #:with-local-connection - #:with-local-passwordless-sudo-connection #:propagate-connattr #:get-connattr @@ -200,6 +198,7 @@ #:hostdeploy-these #:hostdeploy-these* #:continue-deploy* + #:evals ;; data.lisp #:data |