mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-22 06:40:54 +08:00
host register add version record, fix getBmAgentUrl
This commit is contained in:
@@ -42,12 +42,13 @@ func addHandler(method, prefix string, f appsrv.FilterHandler, app *appsrv.Appli
|
||||
}
|
||||
|
||||
func getBmAgentUrl(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
body, _ := appsrv.FetchJSON(r)
|
||||
if body == nil || !body.Contains("ip") {
|
||||
httperrors.InputParameterError(w, "Missing ip ?")
|
||||
_, query, _ := appsrv.FetchEnv(ctx, w, r)
|
||||
ipAddr, err := query.GetString("ip")
|
||||
if err != nil {
|
||||
httperrors.MissingParameterError(w, "ip")
|
||||
return
|
||||
}
|
||||
ipAddr, _ := body.GetString("ip")
|
||||
|
||||
n, _ := models.NetworkManager.GetOnPremiseNetworkOfIP(ipAddr, "baremetal", tristate.None)
|
||||
if n == nil {
|
||||
httperrors.NotFoundError(w, "Network not found")
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/util/version"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
@@ -750,7 +751,7 @@ func (h *SHostInfo) updateHostRecord(hostId string) {
|
||||
content.Set("slots", jsonutils.NewString(options.HostOptions.Slots))
|
||||
}
|
||||
content.Set("__meta__", jsonutils.Marshal(h.getSysInfo()))
|
||||
// content.Set("version", GetVersion())
|
||||
content.Set("version", jsonutils.NewString(version.GetShortString()))
|
||||
body := jsonutils.NewDict()
|
||||
body.Set("host", content)
|
||||
session := h.GetSession()
|
||||
|
||||
Reference in New Issue
Block a user