mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +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")
|
||||
|
||||
Reference in New Issue
Block a user