unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: emacs-devel@gnu.org
Subject: Re: master 55eabe96c9: ; Improve manual for Tramp kubernetes method
Date: Tue, 25 Oct 2022 16:50:27 +0200	[thread overview]
Message-ID: <87ilk8ot3g.fsf@gmx.de> (raw)
In-Reply-To: <m24jvsdc0n.fsf@fastmail.fm> (Filipp Gunbin's message of "Tue, 25 Oct 2022 02:42:32 +0300")

Filipp Gunbin <fgunbin@fastmail.fm> 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 == "<current-context-name>")]}'
--8<---------------cut here---------------end--------------->8---

with <current-context-name> 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.



  reply	other threads:[~2022-10-25 14:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166637666472.14803.2269230477358344016@vcs2.savannah.gnu.org>
     [not found] ` <20221021182424.F0E84C00B0F@vcs2.savannah.gnu.org>
2022-10-22  9:53   ` master 55eabe96c9: ; Improve manual for Tramp kubernetes method Michael Albinus
2022-10-24 14:39     ` Filipp Gunbin
2022-10-24 15:07       ` Michael Albinus
2022-10-24 15:33         ` Michael Albinus
2022-10-24 18:54           ` Michael Albinus
2022-10-24 23:42             ` Filipp Gunbin
2022-10-25 14:50               ` Michael Albinus [this message]
2022-10-25 15:43                 ` Yuri Khan
2022-10-25 15:48                   ` Robert Pluim
2022-10-25 16:02                     ` Yuri Khan
2022-10-25 16:45                       ` Michael Albinus
2022-10-25 17:29             ` Filipp Gunbin
2022-10-25 17:48               ` Michael Albinus
2022-10-25 18:41                 ` Filipp Gunbin
2022-10-25 20:14                 ` Filipp Gunbin
2022-10-26 12:01                   ` Michael Albinus
2022-10-24 20:41         ` Filipp Gunbin
2022-10-24 22:49           ` Filipp Gunbin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilk8ot3g.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).