From c9756aa6f0da02ac8e211dbf7bb88606cadb1aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 14 Feb 2019 15:21:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=B8=8D=E7=9B=B4=E6=8E=A5=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cloudcommon/options.go | 2 +- pkg/webconsole/command/ssh_command.go | 3 +++ pkg/webconsole/options/options.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cloudcommon/options.go b/pkg/cloudcommon/options.go index da63c8bcb8..d712a12cd4 100644 --- a/pkg/cloudcommon/options.go +++ b/pkg/cloudcommon/options.go @@ -56,7 +56,7 @@ type DBOptions struct { AutoSyncTable bool `help:"Automatically synchronize table changes if differences are detected"` GlobalVirtualResourceNamespace bool `help:"Per project namespace or global namespace for virtual resources"` - DebugSqlchemy bool `default:"False" help:"Print SQL executed by sqlchemy"` + DebugSqlchemy bool `default:"false" help:"Print SQL executed by sqlchemy"` } func (this *DBOptions) GetDBConnection() (dialect, connstr string, err error) { diff --git a/pkg/webconsole/command/ssh_command.go b/pkg/webconsole/command/ssh_command.go index 66b38b51f4..b59a78c77b 100644 --- a/pkg/webconsole/command/ssh_command.go +++ b/pkg/webconsole/command/ssh_command.go @@ -30,6 +30,9 @@ type SSHtoolSol struct { func getCommand(ctx context.Context, userCred mcclient.TokenCredential, ip string) (string, *BaseCommand, error) { cmd := NewBaseCommand(o.Options.SshToolPath) + if !o.Options.EnableAutoLogin { + return "", nil, nil + } s := auth.GetAdminSession(ctx, o.Options.Region, "v2") key, err := modules.Sshkeypairs.GetById(s, userCred.GetProjectId(), jsonutils.Marshal(map[string]bool{"admin": true})) if err != nil { diff --git a/pkg/webconsole/options/options.go b/pkg/webconsole/options/options.go index 8ece9467f1..abcdd4a688 100644 --- a/pkg/webconsole/options/options.go +++ b/pkg/webconsole/options/options.go @@ -16,4 +16,5 @@ type WebConsoleOptions struct { IpmitoolPath string `help:"ipmitool binary path used to connect baremetal sol" default:"/usr/bin/ipmitool"` SshToolPath string `help:"sshtool binary path used to connect server sol" default:"/usr/bin/ssh"` SshpassToolPath string `help:"sshpass tool binary path used to connect server sol" default:"/usr/bin/sshpass"` + EnableAutoLogin bool `help:"allow webconsole to log in directly with the cloudroot public key" default:"false"` }