Cloudmigration: Sets the runID correctly when saving (#85661)

Sets the runID correctly instead of setting it to the same as the migration id.
This commit is contained in:
Leonard Gram
2024-04-05 18:03:45 +02:00
committed by GitHub
parent 58f32150c2
commit 1332d8ba24
4 changed files with 10 additions and 8 deletions
+4 -2
View File
@@ -199,7 +199,7 @@ func (cma *CloudMigrationAPI) RunMigration(c *contextmodel.ReqContext) response.
return response.Error(http.StatusInternalServerError, "migration data get error", err)
}
req, err := http.NewRequest("POST", path, bytes.NewReader(body))
req, err := http.NewRequest(http.MethodPost, path, bytes.NewReader(body))
if err != nil {
cma.log.Error("error creating http request for cloud migration run", "err", err.Error())
return response.Error(http.StatusInternalServerError, "http request error", err)
@@ -235,7 +235,7 @@ func (cma *CloudMigrationAPI) RunMigration(c *contextmodel.ReqContext) response.
return response.Error(http.StatusInternalServerError, "unmarshalling migration run response", err)
}
_, err = cma.cloudMigrationService.SaveMigrationRun(ctx, &cloudmigration.CloudMigrationRun{
runID, err := cma.cloudMigrationService.SaveMigrationRun(ctx, &cloudmigration.CloudMigrationRun{
CloudMigrationUID: stringID,
Result: respData,
})
@@ -243,6 +243,8 @@ func (cma *CloudMigrationAPI) RunMigration(c *contextmodel.ReqContext) response.
response.Error(http.StatusInternalServerError, "migration run save error", err)
}
result.RunID = runID
return response.JSON(http.StatusOK, result)
}