mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +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
|
SshKeyFile string
|
||||||
ConnectMode string
|
ConnectMode string
|
||||||
Ignore bool
|
Ignore bool
|
||||||
|
ShellPref string
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSshImportSummary(changeList map[string][]string) string {
|
func createSshImportSummary(changeList map[string][]string) string {
|
||||||
@ -1637,6 +1638,13 @@ func NewHostInfo(hostName string) (*HostInfoType, error) {
|
|||||||
connectMode = sstore.ConnectModeManual
|
connectMode = sstore.ConnectModeManual
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shellPref := sstore.ShellTypePref_Detect
|
||||||
|
if cfgWaveOptions["shellpref"] == "bash" {
|
||||||
|
shellPref = "bash"
|
||||||
|
} else if cfgWaveOptions["shellpref"] == "zsh" {
|
||||||
|
shellPref = "zsh"
|
||||||
|
}
|
||||||
|
|
||||||
outHostInfo := new(HostInfoType)
|
outHostInfo := new(HostInfoType)
|
||||||
outHostInfo.Host = hostName
|
outHostInfo.Host = hostName
|
||||||
outHostInfo.User = userName
|
outHostInfo.User = userName
|
||||||
@ -1645,6 +1653,7 @@ func NewHostInfo(hostName string) (*HostInfoType, error) {
|
|||||||
outHostInfo.SshKeyFile = sshKeyFile
|
outHostInfo.SshKeyFile = sshKeyFile
|
||||||
outHostInfo.ConnectMode = connectMode
|
outHostInfo.ConnectMode = connectMode
|
||||||
outHostInfo.Ignore = shouldIgnore
|
outHostInfo.Ignore = shouldIgnore
|
||||||
|
outHostInfo.ShellPref = shellPref
|
||||||
return outHostInfo, nil
|
return outHostInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1709,6 +1718,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
|||||||
if hostInfo.SshKeyFile != "" {
|
if hostInfo.SshKeyFile != "" {
|
||||||
editMap[sstore.RemoteField_SSHKey] = hostInfo.SshKeyFile
|
editMap[sstore.RemoteField_SSHKey] = hostInfo.SshKeyFile
|
||||||
}
|
}
|
||||||
|
editMap[sstore.RemoteField_ShellPref] = hostInfo.ShellPref
|
||||||
msh := remote.GetRemoteById(previouslyImportedRemote.RemoteId)
|
msh := remote.GetRemoteById(previouslyImportedRemote.RemoteId)
|
||||||
if msh == nil {
|
if msh == nil {
|
||||||
remoteChangeList["updateErr"] = append(remoteChangeList["updateErr"], hostInfo.CanonicalName)
|
remoteChangeList["updateErr"] = append(remoteChangeList["updateErr"], hostInfo.CanonicalName)
|
||||||
@ -1716,7 +1726,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
|||||||
continue
|
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
|
// silently skip this one. it didn't fail, but no changes were needed
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1753,6 +1763,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT
|
|||||||
AutoInstall: true,
|
AutoInstall: true,
|
||||||
SSHOpts: sshOpts,
|
SSHOpts: sshOpts,
|
||||||
SSHConfigSrc: sstore.SSHConfigSrcTypeImport,
|
SSHConfigSrc: sstore.SSHConfigSrcTypeImport,
|
||||||
|
ShellPref: sstore.ShellTypePref_Detect,
|
||||||
}
|
}
|
||||||
err := remote.AddRemote(ctx, r, false)
|
err := remote.AddRemote(ctx, r, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user