Support multiple hostnames for hosts in SSH config - utils.parse_hosts_from_configs() doesn't support multiple host names in a Host line
Host entries in a ssh_config file may have multiple host names, like: Host <short name> <fqdn> <ip address>.
In that case, remote-sshfs creates a ~/.sshfs/<short name> <fqdn> <ip address> mount point and, of course, fails to connect to a host named... <short name> <fqdn> <ip address>.
I have a PR ready, that:
- splits the host names and uses the first non-IP address as a host name.
- excludes a
*host definition from the list of hosts.
I have a question, though:
- my PR adds the multiple host names parsing in the
utils.parse_hosts_from_config()function. The downside is that it keeps only the first non-IP address name in the hosts list. - I could also keep all names in a host["Names"] attribute and, in
connection.init_host()orconnection.mount_host(), iterate through those names until a connection is made. That way, all the host names are visible in the hosts list.
Which approach do you prefer ?
Hey! Thank you so much for your continued contribution and help. I appreciate it.
This is a good one... Could we continue with your "split the host names" and potentially create an entry for each one? Etc, in the telescope connect view each "alias" would have its entry. The underlying SSHFS/SSH call will understand which "host" you are referring to when using any of the names, and the mount point should be reflective of which ever name you use. If some names cause issues with the naming of the directory, we could use a regular express to strip out bad characters.
Does this make sense? Would also love your opinion!