logic improvement
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-25 21:02:17 +10:00
parent 8e399de31e
commit b8abc7e6fd

View File

@@ -113,6 +113,11 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
if strings.ToLower(matches[1]) == strings.ToLower(event.CloudEvent.Data.VM.Name) { if strings.ToLower(matches[1]) == strings.ToLower(event.CloudEvent.Data.VM.Name) {
h.Logger.Debug("This disk belongs to this VM") h.Logger.Debug("This disk belongs to this VM")
found = true
params.UpdateType = "diskchange"
diskSize := h.calculateNewDiskSize(event)
params.NewProvisionedDisk = sql.NullFloat64{Float64: diskSize, Valid: diskSize > 0}
} else { } else {
h.Logger.Debug("This disk belongs to a different VM, don't record this config change") h.Logger.Debug("This disk belongs to a different VM, don't record this config change")
} }
@@ -122,11 +127,8 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
} }
// TODO - recalculate total disk size // TODO - recalculate total disk size
h.Logger.Debug("Detected config change for VM disk") //h.Logger.Debug("Detected config change for VM disk")
found = true
params.UpdateType = "diskchange"
diskSize := h.calculateNewDiskSize(event)
params.NewProvisionedDisk = sql.NullFloat64{Float64: diskSize, Valid: diskSize > 0}
} }
} }