host register add version record, fix getBmAgentUrl

This commit is contained in:
wanyaoqi
2019-04-29 12:06:58 +08:00
parent ae7db24641
commit 40ed21b79e
2 changed files with 7 additions and 5 deletions
+5 -4
View File
@@ -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")