summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sh.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-10-25 16:34:42 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-10-25 16:34:42 +0200
commitfe816fc679ead2100cddb4e51bc81c329bcb4265 (patch)
tree5a8b9214e16e0ee5f05344bed773ff02546521ea /lisp/net/tramp-sh.el
parent8c3b8c36677eedfc3839488e3cef9f6a5937baa3 (diff)
downloademacs-fe816fc679ead2100cddb4e51bc81c329bcb4265.tar.gz
Handle context changes in Tramp kubernetes method
* doc/misc/tramp.texi (Inline methods): Remove note about cache reset. (File name completion): Add tramp-completion-use-cache. * etc/NEWS: Add 'tramp-completion-use-cache'. * lisp/net/tramp-cache.el (tramp-completion-use-cache): New defcustom. (tramp-parse-connection-properties): Use it. * lisp/net/tramp-container.el (tramp-docker--completion-function) (tramp-kubernetes--completion-function): Ensure the processes run locally. (tramp-kubernetes--current-context-data): New defun. (tramp-methods) <kubernetes>: Add `tramp-config-check'. * lisp/net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): Handle `tramp-login-args'. * lisp/net/tramp.el (tramp-methods): Adapt docstring.
Diffstat (limited to 'lisp/net/tramp-sh.el')
-rw-r--r--lisp/net/tramp-sh.el31
1 files changed, 28 insertions, 3 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index d74afc84126..3904348232b 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4472,7 +4472,8 @@ process to set up. VEC specifies the connection."
;; Check whether the output of "uname -sr" has been changed. If
;; yes, this is a strong indication that we must expire all
;; connection properties. We start again with
- ;; `tramp-maybe-open-connection', it will be caught there.
+ ;; `tramp-maybe-open-connection', it will be caught there. The same
+ ;; check will be applied with the function kept in`tramp-config-check'.
(tramp-message vec 5 "Checking system information")
(let* ((old-uname (tramp-get-connection-property vec "uname"))
(uname
@@ -4481,8 +4482,23 @@ process to set up. VEC specifies the connection."
old-uname
(tramp-set-connection-property
vec "uname"
- (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))))
- (when (and (stringp old-uname) (not (string-equal old-uname uname)))
+ (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
+ (config-check-function
+ (tramp-get-method-parameter vec 'tramp-config-check))
+ (old-config-check
+ (and config-check-function
+ (tramp-get-connection-property vec "config-check-data")))
+ (config-check
+ (and config-check-function
+ ;; If we are in `make-process', we don't need to recompute.
+ (if (and old-config-check
+ (tramp-get-connection-property vec "process-name"))
+ old-config-check
+ (tramp-set-connection-property
+ vec "config-check-data"
+ (tramp-compat-funcall config-check-function vec))))))
+ (when (and (stringp old-uname) (stringp uname)
+ (not (string-equal old-uname uname)))
(tramp-message
vec 3
"Connection reset, because remote host changed from `%s' to `%s'"
@@ -4490,6 +4506,15 @@ process to set up. VEC specifies the connection."
;; We want to keep the password.
(tramp-cleanup-connection vec t t)
(throw 'uname-changed (tramp-maybe-open-connection vec)))
+ (when (and (stringp old-config-check) (stringp config-check)
+ (not (string-equal old-config-check config-check)))
+ (tramp-message
+ vec 3
+ "Connection reset, because remote configuration changed from `%s' to `%s'"
+ old-config-check config-check)
+ ;; We want to keep the password.
+ (tramp-cleanup-connection vec t t)
+ (throw 'uname-changed (tramp-maybe-open-connection vec)))
;; Try to set up the coding system correctly.
;; CCC this can't be the right way to do it. Hm.