aboutsummaryrefslogtreecommitdiff
path: root/src/connection.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-16 20:33:05 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-16 20:35:39 -0700
commit42b390533e1faafe7c5cbb23eb0b39315b403dca (patch)
treec0e839f9018b055622f9bade698506922ba684b3 /src/connection.lisp
parent310961aedca8ac1609228880b882c791a028977b (diff)
downloadconsfigurator-42b390533e1faafe7c5cbb23eb0b39315b403dca.tar.gz
add WITH-LOCAL-PASSWORDLESS-SUDO-CONNECTION
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r--src/connection.lisp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/connection.lisp b/src/connection.lisp
index c666de3..bc19c26 100644
--- a/src/connection.lisp
+++ b/src/connection.lisp
@@ -446,3 +446,11 @@ 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)))