diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-01 13:04:49 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-01 15:47:54 -0700 |
commit | 70521cc0b6c862af70f0bb8f1f801d3e0b5bf4d2 (patch) | |
tree | 00fbf4ed4b4dbb4f02e1079133bbbfbff1b09b28 /src | |
parent | 044f74e8219ec424a05f43427b726185f6c2dfb1 (diff) | |
download | consfigurator-70521cc0b6c862af70f0bb8f1f801d3e0b5bf4d2.tar.gz |
add WITH-LOCAL-CONNECTION
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.lisp | 8 | ||||
-rw-r--r-- | src/package.lisp | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index 1af7a29..d1fe24c 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -420,3 +420,11 @@ PATH may be any kind of file, including directories." ;; we may not be able to chown; that's okay (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)) diff --git a/src/package.lisp b/src/package.lisp index 336cfcd..f9b7172 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -102,6 +102,7 @@ #:delete-remote-tree #:readfile #:writefile + #:with-local-connection ;; property.lisp #:propattrs |