forked from toolshed/abra
		
	fix: avoid default value for idf
We could default to ~/.ssh/id_rsa but if that doesn't exist, then we'll just be confusing people in the logs. Best is to just rely on the ssh-agent which overrides this anyway. We will document this. See coop-cloud/organising#277
This commit is contained in:
		| @ -475,11 +475,10 @@ func GetContextConnDetails(serverName string) (*dockerSSHPkg.Spec, error) { | |||||||
| func GetHostConfig(hostname, username, port string) (HostConfig, error) { | func GetHostConfig(hostname, username, port string) (HostConfig, error) { | ||||||
| 	var hostConfig HostConfig | 	var hostConfig HostConfig | ||||||
|  |  | ||||||
| 	var host, idf string | 	if hostname == "" { | ||||||
|  | 		if hostname = ssh_config.Get(hostname, "Hostname"); hostname == "" { | ||||||
| 	if host = ssh_config.Get(hostname, "Hostname"); host == "" { | 			logrus.Debugf("no hostname found in SSH config, assuming %s", hostname) | ||||||
| 		logrus.Debugf("no hostname found in SSH config, assuming %s", hostname) | 		} | ||||||
| 		host = hostname |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if username == "" { | 	if username == "" { | ||||||
| @ -500,17 +499,19 @@ func GetHostConfig(hostname, username, port string) (HostConfig, error) { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	idf = ssh_config.Get(hostname, "IdentityFile") | 	if idf := ssh_config.Get(hostname, "IdentityFile"); idf != "" && idf != "~/.ssh/identity" { | ||||||
| 	if idf != "" { |  | ||||||
| 		var err error | 		var err error | ||||||
| 		idf, err = identityFileAbsPath(idf) | 		idf, err = identityFileAbsPath(idf) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return hostConfig, err | 			return hostConfig, err | ||||||
| 		} | 		} | ||||||
| 		hostConfig.IdentityFile = idf | 		hostConfig.IdentityFile = idf | ||||||
|  | 	} else { | ||||||
|  | 		logrus.Debugf("no identity file found in SSH config for %s", hostname) | ||||||
|  | 		hostConfig.IdentityFile = "" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	hostConfig.Host = host | 	hostConfig.Host = hostname | ||||||
| 	hostConfig.Port = port | 	hostConfig.Port = port | ||||||
| 	hostConfig.User = username | 	hostConfig.User = username | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user