diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-29 13:01:49 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-30 17:46:39 -0700 |
commit | 76f0787a03fde26243d0034d3c15c444df5ea69c (patch) | |
tree | 288706fb111a3a65fa3490d97cb1c5e02fdba77e /src | |
parent | 844818aa56e9ed75b9600f5ef6e833bb5fdacaca (diff) | |
download | consfigurator-76f0787a03fde26243d0034d3c15c444df5ea69c.tar.gz |
CONTINUE-DEPLOY* connections: push a new connection object
This is cleaner than resetting certain slot values.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.lisp | 9 | ||||
-rw-r--r-- | src/connection/fork.lisp | 4 | ||||
-rw-r--r-- | src/connection/rehome.lisp | 3 | ||||
-rw-r--r-- | src/deployment.lisp | 5 | ||||
-rw-r--r-- | src/package.lisp | 11 |
5 files changed, 10 insertions, 22 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index 87f7844..9f71bc7 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -85,15 +85,6 @@ For an example of usage, see the :SUDO connection type.")) :documentation "The name of the remote user."))) -(defun reset-remote-home () - "Clear the cache of the remote user's home directory, uid and name. -Used by implementations of ESTABLISH-CONNECTION which will invalidate the -cached values, such as a connection which forks and then SETUIDs to another -user. Should not be called by properties." - (setf (slot-value *connection* 'remote-home) nil - (slot-value *connection* 'remote-uid) nil - (slot-value *connection* 'remote-user) nil)) - (defclass lisp-connection (connection) ()) (defclass posix-connection (connection) ()) diff --git a/src/connection/fork.lisp b/src/connection/fork.lisp index 295f8a2..a8c3631 100644 --- a/src/connection/fork.lisp +++ b/src/connection/fork.lisp @@ -45,7 +45,7 @@ for example, such that we don't see it." (and #+sbcl (> 2 (length (sb-thread:list-all-threads))))) -(defclass fork-connection (lisp-connection) ()) +(defclass fork-connection (local-connection) ()) (defgeneric post-fork (connection) (:documentation @@ -95,7 +95,7 @@ for example, such that we don't see it." ;; the child afterwards, rather than returning to the child's ;; REPL or whatever else. (uiop:quit - (if (eql :no-change (continue-deploy* remaining)) + (if (eql :no-change (continue-deploy* connection remaining)) 0 1))))) (t diff --git a/src/connection/rehome.lisp b/src/connection/rehome.lisp index 77aaf6d..5b57d5f 100644 --- a/src/connection/rehome.lisp +++ b/src/connection/rehome.lisp @@ -26,9 +26,6 @@ (:documentation "A connection which works by switching to a new HOME on the same host.")) -(defmethod post-fork :before ((connection rehome-connection)) - (reset-remote-home)) - (defmethod connection-upload ((connection rehome-connection) (data file-data)) (with-slots (iden1 iden2 data-version) data (let ((inside (data-pathname diff --git a/src/deployment.lisp b/src/deployment.lisp index 5a70e15..7d1af93 100644 --- a/src/deployment.lisp +++ b/src/deployment.lisp @@ -77,12 +77,13 @@ DEFHOST forms can override earlier entries (see DEFHOST's docstring)." (%consfigure (preprocess-connections connections) (replace-propspec-into-host host properties))) -(defun continue-deploy* (remaining-connections) +(defun continue-deploy* (connection remaining-connections) "Complete the work of an enclosing call to DEPLOY* or DEPLOY-THESE*. Used by implementations of ESTABLISH-CONNECTION which need to do something like fork(2) and then return to Consfigurator's primary loop in the child." - (%consfigure remaining-connections *host*)) + (let ((*connection* connection)) + (%consfigure remaining-connections *host*))) ;; in the following two macros, bind *HOST* so that evaluation of the ;; unevaluated propspec can retrieve existing hostattrs; shallow copy just in diff --git a/src/package.lisp b/src/package.lisp index 56ccddb..3af51b1 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -94,7 +94,6 @@ #:posix-connection #:connection-parent #:lisp-connection-p - #:reset-remote-home #:connection-run #:connection-readfile #:connection-writefile @@ -445,12 +444,16 @@ (:export #:available #:selected-for)) +(defpackage :consfigurator.connection.local + (:use #:cl #:consfigurator #:alexandria) + (:export #:local-connection)) + (defpackage :consfigurator.connection.shell-wrap (:use #:cl #:consfigurator) (:export #:shell-wrap-connection #:connection-shell-wrap)) (defpackage :consfigurator.connection.fork - (:use #:cl #:consfigurator) + (:use #:cl #:consfigurator #:consfigurator.connection.local) (:export #:fork-connection #:post-fork #:can-probably-fork)) @@ -483,10 +486,6 @@ #:consfigurator #:consfigurator.connection.shell-wrap)) -(defpackage :consfigurator.connection.local - (:use #:cl #:consfigurator #:alexandria) - (:export #:local-connection)) - (defpackage :consfigurator.connection.chroot (:use #:cl #:consfigurator |