Michael Albinus <[email protected]> writes:

> Eshel Yaron <[email protected]> writes:
>
>>> All parameters specified by tramp-methods can be overwritten by
>>> connection properties, see (info "(tramp) Predefined connection 
>>> information")
>>>
>>> In your case, you could do (untested)
>>>
>>> (add-to-list 'tramp-connection-properties
>>>               (list "^/kubedv2:user@example\\.com:")
>>>                     "login-program" "/another/kubectl"))
>>
>> Thanks.  I'm not sure it applies to my use case, but perhaps I'm missing
>> something:
>>
>> IIUC, tramp-connection-properties lets users override the login-program
>> used for the first hop, whereas we need to allow the login-program of
>> the second hop to depend on the first.  Namely, considering a file name
>> such as "/ssh:[email protected]|kubedv2:...:/some/file", we want Tramp to
>> use the connection-local value of kubed-kubectl-program in
>> "/ssh:[email protected]:" as the login-program for the second hop.
>>
>> So far I couldn't find a way to do that with
>> tramp-connection-properties, did I miss anything?
>>
>> FWIW I tried:
>>
>>   (add-to-list 'tramp-connection-properties
>>                (list "example.com.*kubedv2" "login-program" 
>> "/another/kubectl"))
>>
>> This would be more cumbersome than reusing the connection-local value of
>> kubed-kubectl-program, but it would be a step in the right direction.
>> Unfortunately, that didn't seem to work, I think because the previous
>> hop isn't included in the string that is matched against the regexp.
>
> Your setting apply. You need to set this for the second hop.
>
> You didn't say what's the hop name in your example, so I've guessed
> it. Try the setting
>
> (add-to-list 'tramp-connection-properties
>              (list "^/kubedv2:kube-hostname:" "login-program" 
> "/another/kubectl"))
>
> kube-hostname must be adapted.

Hmm, but this does not specify the first host, and that  is the what
actually determines the login-program in our case, not the kube-hostname
that we're connecting to.
We want "/ssh:[email protected]|kubedv2:kubed-hostname:/some/file" to use
a different kubectl (on example.com) than the one we use (locally) for
"/kubedv2:kube-hostname:/some/file" or via another first hop, and we
want Tramp to use that different kubectl for all kubedv2 connection that
follow a "/ssh:[email protected]" hop, not just to a specific kube-hostname.
Hope that makes it clearer.


Thanks,

Eshel

Reply via email to