From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method Date: Tue, 25 Oct 2022 16:50:27 +0200 Message-ID: <87ilk8ot3g.fsf@gmx.de> References: <166637666472.14803.2269230477358344016@vcs2.savannah.gnu.org> <20221021182424.F0E84C00B0F@vcs2.savannah.gnu.org> <87tu3w6v74.fsf@gmx.de> <87a65l6z0l.fsf@gmx.de> <875yg96xu8.fsf@gmx.de> <871qqx6oi5.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24275"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 25 16:52:04 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onLHf-0005yv-RO for ged-emacs-devel@m.gmane-mx.org; Tue, 25 Oct 2022 16:52:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onLGG-0000Je-Ma; Tue, 25 Oct 2022 10:50:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onLGD-0008PU-6w for emacs-devel@gnu.org; Tue, 25 Oct 2022 10:50:33 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onLGA-0008At-Qn for emacs-devel@gnu.org; Tue, 25 Oct 2022 10:50:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666709428; bh=ity4FNje3n1Syg9AcGtJhhxsKXUKzAMDIp3Kb4A9cSk=; h=X-UI-Sender-Class:From:To:Subject:In-Reply-To:References:Date; b=cB4gzprAg5s/95pMBCeGHk9Y3vlZ2MT+yZSkVBb667Aq6nBbvI0wO9dEa3NT+p6gg IAMDxeiWh8SpJRmO4QITa8P6Ps9027QeqGPLVtmZ5MsPaw3TdmdOc34qwKjl3rB1bL Y150hrYkoVDT914ztqIDcZgAQ2i/0yXUZl9wFeYg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.148.109]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MzQg6-1p0JjY14BU-00vOcZ for ; Tue, 25 Oct 2022 16:50:28 +0200 In-Reply-To: (Filipp Gunbin's message of "Tue, 25 Oct 2022 02:42:32 +0300") X-Provags-ID: V03:K1:d/A04xez0OJH0aRzQa3oZfq4k7kRO8j0MflKs7tbwHPwwLh0WHp QbfqerjoUVcpSTU3CHP6AIDxyztHIcC+WK10FlLXuoYL1h1RDpKcuwzCkzQzVhmldl85TJY NaMuLWqhRktl7Rjz+EfeurXgwDj8nJC96eTb7bGLjJbB4BoPefYN4q8GrfVxjG9VzGjsQ5Z vQOumV81tgRMOc3jDKf6A== X-UI-Out-Filterresults: notjunk:1;V03:K0:+p2WxJqEAN0=:65WisoiPFBDMwgWIX89aoT FRD2LtfZMl8trYbrzOTuctc9VzlbAJy/1sXSP4bg6RVGtZotlgEAZOw0o20PqbdKC+T5GB3mY H6nn7STGGTUobo1U91v9l4RhpBN7hJ7cR0pJcDbdFNo/mJH52KTcv+03XpRjjC+IrOkpggVE4 p9wweo0HZdrunSRe6tVKLNlbTKsrXM3+Wnt3Jxetf/Ck9J6gOd7IrOtfxuZV3YhJGUzWZtiPu +UPKFScbe9L/nlqxnyPKyfpEHuWVj7fh1QzGZnShl8voqe7byVE6AG/MLRiKKarByOVZvFH1Z SslMjQVFp+kTdsrfFDgx1Lv4ldtP/sq1FMY+JeDbcA+062xth5wan8ZzyGoxQEd4WMvQbaMyl H5N+O+RVGEtMEvywIzNfnPwt/4rf4YaFYpTXjHk3mdiWW2H50PKcq0fc3ktXwB8/UMK3fgu/R zm4++n7Sd3CZy2Pz53rLHSTxkaI8qiE7q0pUL8YHcXz2qh/LBZ2ZcSvatD9x+9uBguKAxe2lR rwxK0L8+mgrDx1SoCHUzn6jEx0WcDuG3fYK/vNVVA4KejseeJ7Vy8l6qd0fclHGE2VWMI280s 1CZkXWsyjGTHPqkReDIRi/duTkuRl5epYK+YFNRM8RlZD39YDGnsctkU9SOGJ+bSGl1/Z0Tx6 LDogkHtpUh0D94mvJP4YFrzyVFaQY3GYWAh2E4cpXFm7XbxBXSlAM2r5kOhLbusq0rJypUFwK 2z7Hmhj6zrJZhOfljPosCE+33t3T7LJn68A4EJJ9CdXI28WRFrPq1wB75h+RTpQ7+WSSgKPK Received-SPF: pass client-ip=212.227.15.18; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298471 Archived-At: Filipp Gunbin writes: > Hi Michael, Hi Filipp, > Generally it works, thank you very much! Thanks for checking! > Test case: > > 1) kubectl config set-context --current --namespace=main > 2) dired /kubernetes:myapp-67cd597654-wxdjn:/ > 3) tramp-cleanup-this-connection > 4) kubectl config set-context --current --namespace= > 5) again dired /kubernetes:myapp-67cd597654-wxdjn:/ - I get an error and > cache is cleared > > However, now auto-completing /kubernetes: shows this, why 2? > > In this buffer, type RET to select the completion near point. > > 2 possible completions: > kubernetes: Hmm. It says 2 possible completions, but doesn't show anything. Not sure what this means. Anayway, I've added a new user option to Tramp, tramp-completion-use-cache. If you set it to nil, Tramp doesn't use cached connections for host name completion. This shall fix your use case. > Another issue: if at step 5 I instead use existing dired window and > type, say, "i" on a subdirectory, then I get the same-looking error, but > the Tramp cache is not cleared (perhaps this is not > Kubernetes-specific). Cannot say anything, let's see whether it is still present after the following changes. >> +(defun tramp-kubernetes--current-context-data (vec) >> + "Return current context data as JSON string." >> + (with-temp-buffer >> + (when (zerop >> + (tramp-call-process >> + vec tramp-kubernetes-program nil t nil >> + "config" "view" "--minify" "-o" "json")) >> + (buffer-string)))) >> + > > Let's remove --minify. > > Also, maybe save the checksum (simple md5 would do it), not the full > listing? The listing may contain sensitive data (for example, mine > shows my OAuth id token). Right, there's too much data. And Tramp shouldn't expose sensible data. Finally, I've changed this to --8<---------------cut here---------------start------------->8--- # kubectl config view -o jsonpath='{.contexts[?(@.name == "")]}' --8<---------------cut here---------------end--------------->8--- with being the name of the current context. This shows just the fields in the current context, and nothing else - that's exactly what we need for the check. >> + (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) > > Currently, we'll get huge config listings here (at the level 3)? If we > change to checksums, that'd be not very useful. So perhaps don't output > those strings? With the change above, the check string is much shorter. Yes, we could use checksums, but this will prevent us to understand why the connection cache has been cleared. And this shouldn't happen too often, so I guess a message of level 3 is still useful and not too annoying. >> + * `tramp-config-check' >> + A function to be called with one argument, VEC. It should >> + return a string which is used to check, whether the > > Comma not needed? Don't know. In the Tramp sources, both "check, whether" and "check whether" is used, so it is inconsistent at all :-) Let's keep it, until somebody teaches me to change it this way or the other in all places. >> * `tramp-copy-program' >> This specifies the name of the program to use for remotely copying >> the file; this might be the absolute filename of scp or the name of > > Also, my added paragraph in manual can be removed now. Done. I've committed my last version of the patch, because I believe it is more simple to discuss about. Further comments welcome! > Thanks. > Filipp Best regards, Michael.