修复 「新建的资产总是使用默认而不是原生连接ssh」 close #62
This commit is contained in:
parent
d5d775fb4e
commit
de91d16b63
@ -11,8 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func AssetCreateEndpoint(c echo.Context) error {
|
func AssetCreateEndpoint(c echo.Context) error {
|
||||||
|
m := echo.Map{}
|
||||||
|
if err := c.Bind(&m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
data, _ := json.Marshal(m)
|
||||||
var item model.Asset
|
var item model.Asset
|
||||||
if err := c.Bind(&item); err != nil {
|
if err := json.Unmarshal(data, &item); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,6 +31,10 @@ func AssetCreateEndpoint(c echo.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := model.UpdateAssetAttributes(item.ID, item.Protocol, m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// 创建后自动检测资产是否存活
|
// 创建后自动检测资产是否存活
|
||||||
go func() {
|
go func() {
|
||||||
active := utils.Tcping(item.IP, item.Port)
|
active := utils.Tcping(item.IP, item.Port)
|
||||||
|
Loading…
Reference in New Issue
Block a user