mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
autoinstall, fix version check
This commit is contained in:
@@ -473,6 +473,7 @@ func RemoteNewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss
|
|||||||
if !sstore.IsValidConnectMode(connectMode) {
|
if !sstore.IsValidConnectMode(connectMode) {
|
||||||
return nil, fmt.Errorf("/remote:new invalid connectmode %q: valid modes are %s", connectMode, formatStrs([]string{sstore.ConnectModeStartup, sstore.ConnectModeAuto, sstore.ConnectModeManual}, "or", false))
|
return nil, fmt.Errorf("/remote:new invalid connectmode %q: valid modes are %s", connectMode, formatStrs([]string{sstore.ConnectModeStartup, sstore.ConnectModeAuto, sstore.ConnectModeManual}, "or", false))
|
||||||
}
|
}
|
||||||
|
autoInstall := resolveBool(pk.Kwargs["autoinstall"], true)
|
||||||
var isSudo bool
|
var isSudo bool
|
||||||
if sudoStr != "" {
|
if sudoStr != "" {
|
||||||
isSudo = true
|
isSudo = true
|
||||||
@@ -522,6 +523,7 @@ func RemoteNewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss
|
|||||||
RemoteUser: remoteUser,
|
RemoteUser: remoteUser,
|
||||||
RemoteHost: remoteHost,
|
RemoteHost: remoteHost,
|
||||||
ConnectMode: connectMode,
|
ConnectMode: connectMode,
|
||||||
|
AutoInstall: autoInstall,
|
||||||
SSHOpts: sshOpts,
|
SSHOpts: sshOpts,
|
||||||
RemoteOpts: remoteOpts,
|
RemoteOpts: remoteOpts,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ func (msh *MShellProc) Launch() {
|
|||||||
if err == context.Canceled {
|
if err == context.Canceled {
|
||||||
err = fmt.Errorf("forced disconnection")
|
err = fmt.Errorf("forced disconnection")
|
||||||
}
|
}
|
||||||
if semver.MajorMinor(mshellVersion) != semver.MajorMinor(MShellVersion) {
|
if err == nil && semver.MajorMinor(mshellVersion) != semver.MajorMinor(MShellVersion) {
|
||||||
err = fmt.Errorf("mshell version is not compatible current=%s remote=%s", MShellVersion, mshellVersion)
|
err = fmt.Errorf("mshell version is not compatible current=%s remote=%s", MShellVersion, mshellVersion)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+2
-2
@@ -127,8 +127,8 @@ func UpsertRemote(ctx context.Context, r *RemoteType) error {
|
|||||||
maxRemoteIdx := tx.GetInt(query)
|
maxRemoteIdx := tx.GetInt(query)
|
||||||
r.RemoteIdx = int64(maxRemoteIdx + 1)
|
r.RemoteIdx = int64(maxRemoteIdx + 1)
|
||||||
query = `INSERT INTO remote
|
query = `INSERT INTO remote
|
||||||
( remoteid, physicalid, remotetype, remotealias, remotecanonicalname, remotesudo, remoteuser, remotehost, connectmode, initpk, sshopts, remoteopts, lastconnectts, archived, remoteidx) VALUES
|
( remoteid, physicalid, remotetype, remotealias, remotecanonicalname, remotesudo, remoteuser, remotehost, connectmode, autoinstall, initpk, sshopts, remoteopts, lastconnectts, archived, remoteidx) VALUES
|
||||||
(:remoteid,:physicalid,:remotetype,:remotealias,:remotecanonicalname,:remotesudo,:remoteuser,:remotehost,:connectmode,:initpk,:sshopts,:remoteopts,:lastconnectts,:archived,:remoteidx)`
|
(:remoteid,:physicalid,:remotetype,:remotealias,:remotecanonicalname,:remotesudo,:remoteuser,:remotehost,:connectmode,:autoinstall,:initpk,:sshopts,:remoteopts,:lastconnectts,:archived,:remoteidx)`
|
||||||
tx.NamedExecWrap(query, r.ToMap())
|
tx.NamedExecWrap(query, r.ToMap())
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -681,6 +681,7 @@ func EnsureLocalRemote(ctx context.Context) error {
|
|||||||
RemoteUser: user.Username,
|
RemoteUser: user.Username,
|
||||||
RemoteHost: hostName,
|
RemoteHost: hostName,
|
||||||
ConnectMode: ConnectModeStartup,
|
ConnectMode: ConnectModeStartup,
|
||||||
|
AutoInstall: true,
|
||||||
SSHOpts: &SSHOpts{Local: true},
|
SSHOpts: &SSHOpts{Local: true},
|
||||||
}
|
}
|
||||||
err = UpsertRemote(ctx, localRemote)
|
err = UpsertRemote(ctx, localRemote)
|
||||||
@@ -714,6 +715,7 @@ func AddTest01Remote(ctx context.Context) error {
|
|||||||
SSHIdentity: "/Users/mike/aws/mfmt.pem",
|
SSHIdentity: "/Users/mike/aws/mfmt.pem",
|
||||||
},
|
},
|
||||||
ConnectMode: ConnectModeStartup,
|
ConnectMode: ConnectModeStartup,
|
||||||
|
AutoInstall: true,
|
||||||
}
|
}
|
||||||
err = UpsertRemote(ctx, testRemote)
|
err = UpsertRemote(ctx, testRemote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -745,6 +747,7 @@ func AddTest02Remote(ctx context.Context) error {
|
|||||||
SSHUser: "test2",
|
SSHUser: "test2",
|
||||||
},
|
},
|
||||||
ConnectMode: ConnectModeStartup,
|
ConnectMode: ConnectModeStartup,
|
||||||
|
AutoInstall: true,
|
||||||
}
|
}
|
||||||
err = UpsertRemote(ctx, testRemote)
|
err = UpsertRemote(ctx, testRemote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user