handle resource pool move
This commit is contained in:
@@ -25,6 +25,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
|
||||
var unixTimestamp int64
|
||||
|
||||
re := regexp.MustCompile(`/([^/]+)/[^/]+\.vmdk$`)
|
||||
ctx := context.Background()
|
||||
|
||||
reqBody, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
@@ -142,7 +143,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
|
||||
VmId: sql.NullString{String: event.CloudEvent.Data.VM.VM.Value, Valid: event.CloudEvent.Data.VM.VM.Value != ""},
|
||||
DatacenterName: sql.NullString{String: event.CloudEvent.Data.Datacenter.Name, Valid: event.CloudEvent.Data.Datacenter.Name != ""},
|
||||
}
|
||||
invResult, err := h.Database.Queries().GetInventoryVmId(context.Background(), invParams)
|
||||
invResult, err := h.Database.Queries().GetInventoryVmId(ctx, invParams)
|
||||
|
||||
if err != nil {
|
||||
h.Logger.Error("unable to find existing inventory record for this VM", "error", err)
|
||||
@@ -168,7 +169,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
|
||||
params.UserName = sql.NullString{String: event.CloudEvent.Data.UserName, Valid: event.CloudEvent.Data.UserName != ""}
|
||||
|
||||
// Create the Update database record
|
||||
result, err := h.Database.Queries().CreateUpdate(context.Background(), params)
|
||||
result, err := h.Database.Queries().CreateUpdate(ctx, params)
|
||||
if err != nil {
|
||||
h.Logger.Error("unable to perform database insert", "error", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user