mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-16 15:07:59 +08:00
fix: baremetal server ssh no ip for project user (#25840)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -217,13 +217,13 @@ func handleSshShell(ctx context.Context, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
switch sshConnInfo.ResourceType {
|
||||
case "server":
|
||||
err = tryServer()
|
||||
err := tryServer()
|
||||
if err != nil {
|
||||
httperrors.GeneralServerError(ctx, w, err)
|
||||
return
|
||||
}
|
||||
case "host":
|
||||
err = tryHost()
|
||||
err := tryHost()
|
||||
if err != nil {
|
||||
httperrors.GeneralServerError(ctx, w, err)
|
||||
return
|
||||
@@ -233,7 +233,7 @@ func handleSshShell(ctx context.Context, w http.ResponseWriter, r *http.Request)
|
||||
tryServer,
|
||||
tryHost,
|
||||
} {
|
||||
err = try()
|
||||
err := try()
|
||||
if err == nil {
|
||||
s := session.NewSshSession(ctx, env.ClientSessin, sshConnInfo)
|
||||
handleSshSession(ctx, s, w)
|
||||
|
||||
@@ -24,9 +24,11 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
webconsole_options "yunion.io/x/onecloud/pkg/webconsole/options"
|
||||
)
|
||||
|
||||
type SSshConnectionInfo struct {
|
||||
@@ -60,7 +62,8 @@ func resolveServerIPPortById(ctx context.Context, s *mcclient.ClientSession, id
|
||||
True := true
|
||||
input.Details = &True
|
||||
input.ServerFilterListInput.Scope = "max"
|
||||
result, err := compute.Servernetworks.List(s, jsonutils.Marshal(input))
|
||||
adminSession := auth.GetAdminSession(ctx, webconsole_options.Options.Region)
|
||||
result, err := compute.Servernetworks.List(adminSession, jsonutils.Marshal(input))
|
||||
if err != nil {
|
||||
return "", 0, nil, errors.Wrap(err, "Servernetworks.List")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user