mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix: set shellpref default settings for backend
The shell preference is a new feature that was never integrated into ssh config importing. This makes the backend changes to allow that to happen.
This commit is contained in:
parent
5ce7b92232
commit
0417c8a158
@ -1542,6 +1542,7 @@ type HostInfoType struct {
|
||||
SshKeyFile string
|
||||
ConnectMode string
|
||||
Ignore bool
|
||||
ShellPref string
|
||||
}
|
||||
|
||||
func createSshImportSummary(changeList map[string][]string) string {
|
||||
@ -1637,6 +1638,13 @@ func NewHostInfo(hostName string) (*HostInfoType, error) {
|
||||
connectMode = sstore.ConnectModeManual
|
||||
}
|
||||
|
||||
shellPref := sstore.ShellTypePref_Detect
|
||||
if cfgWaveOptions["shellpref"] == "bash" {
|
||||
shellPref = "bash"
|
||||
} else if cfgWaveOptions["shellpref"] == "zsh" {
|
||||
shellPref = "zsh"
|
||||
}
|
||||
|
||||
outHostInfo := new(HostInfoType)
|
||||
outHostInfo.Host = hostName
|
||||
outHostInfo.User = userName
|
||||
@ -1645,6 +1653,7 @@ func NewHostInfo(hostName string) (*HostInfoType, error) {
|
||||
outHostInfo.SshKeyFile = sshKeyFile
|
||||
outHostInfo.ConnectMode = connectMode
|
||||
outHostInfo.Ignore = shouldIgnore
|
||||
outHostInfo.ShellPref = shellPref
|
||||
return outHostInfo, nil
|
||||
}
|
||||
|
||||
@ -1709,6 +1718,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
||||
if hostInfo.SshKeyFile != "" {
|
||||
editMap[sstore.RemoteField_SSHKey] = hostInfo.SshKeyFile
|
||||
}
|
||||
editMap[sstore.RemoteField_ShellPref] = hostInfo.ShellPref
|
||||
msh := remote.GetRemoteById(previouslyImportedRemote.RemoteId)
|
||||
if msh == nil {
|
||||
remoteChangeList["updateErr"] = append(remoteChangeList["updateErr"], hostInfo.CanonicalName)
|
||||
@ -1716,7 +1726,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
||||
continue
|
||||
}
|
||||
|
||||
if msh.Remote.ConnectMode == hostInfo.ConnectMode && msh.Remote.SSHOpts.SSHIdentity == hostInfo.SshKeyFile && msh.Remote.RemoteAlias == hostInfo.Host {
|
||||
if msh.Remote.ConnectMode == hostInfo.ConnectMode && msh.Remote.SSHOpts.SSHIdentity == hostInfo.SshKeyFile && msh.Remote.RemoteAlias == hostInfo.Host && msh.Remote.ShellPref == hostInfo.ShellPref {
|
||||
// silently skip this one. it didn't fail, but no changes were needed
|
||||
continue
|
||||
}
|
||||
@ -1753,6 +1763,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
||||
AutoInstall: true,
|
||||
SSHOpts: sshOpts,
|
||||
SSHConfigSrc: sstore.SSHConfigSrcTypeImport,
|
||||
ShellPref: sstore.ShellTypePref_Detect,
|
||||
}
|
||||
err := remote.AddRemote(ctx, r, false)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user