mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
use batchmode for non-manual connections. don't allow duplicate aliases for remotes
This commit is contained in:
@@ -770,6 +770,9 @@ func (msh *MShellProc) Launch() {
|
||||
msh.WriteToPtyBuffer("connecting to %s...\n", remoteCopy.RemoteCanonicalName)
|
||||
sshOpts := convertSSHOpts(remoteCopy.SSHOpts)
|
||||
sshOpts.SSHErrorsToTty = true
|
||||
if remoteCopy.ConnectMode != sstore.ConnectModeManual {
|
||||
sshOpts.BatchMode = true
|
||||
}
|
||||
cmdStr := MakeServerCommandStr()
|
||||
ecmd := sshOpts.MakeSSHExecCmd(cmdStr)
|
||||
cmdPty, err := msh.addControllingTty(ecmd)
|
||||
@@ -820,7 +823,7 @@ func (msh *MShellProc) Launch() {
|
||||
}
|
||||
if err != nil {
|
||||
msh.setErrorStatus(err)
|
||||
msh.WriteToPtyBuffer("*error connecting to remote (uname=%q): %v\n", msh.UName, err)
|
||||
msh.WriteToPtyBuffer("*error connecting to remote: %v\n", err)
|
||||
return
|
||||
}
|
||||
msh.WriteToPtyBuffer("connected\n")
|
||||
|
||||
@@ -123,6 +123,10 @@ func UpsertRemote(ctx context.Context, r *RemoteType) error {
|
||||
if tx.Exists(query, r.RemoteCanonicalName) {
|
||||
return fmt.Errorf("remote has duplicate canonicalname '%s', cannot create", r.RemoteCanonicalName)
|
||||
}
|
||||
query = `SELECT remoteid FROM remote WHERE alias = ?`
|
||||
if r.RemoteAlias != "" && tx.Exists(query, r.RemoteAlias) {
|
||||
return fmt.Errorf("remote has duplicate alias '%s', cannot create", r.RemoteAlias)
|
||||
}
|
||||
query = `SELECT COALESCE(max(remoteidx), 0) FROM remote`
|
||||
maxRemoteIdx := tx.GetInt(query)
|
||||
r.RemoteIdx = int64(maxRemoteIdx + 1)
|
||||
|
||||
@@ -83,6 +83,7 @@ type RemoteEditType struct {
|
||||
RemoteEdit bool `json:"remoteedit"`
|
||||
RemoteId string `json:"remoteid,omitempty"`
|
||||
ErrorStr string `json:"errorstr,omitempty"`
|
||||
InfoStr string `json:"infostr,omitempty"`
|
||||
}
|
||||
|
||||
type InfoMsgType struct {
|
||||
|
||||
Reference in New Issue
Block a user