dont query vm folder path unless we need to
Some checks are pending
continuous-integration/drone/push Build is passing
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

This commit is contained in:
2024-09-16 13:52:56 +10:00
parent 4efdf50433
commit e47718cd7f
3 changed files with 23 additions and 17 deletions

View File

@@ -74,6 +74,14 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
params.NewRam = sql.NullInt64{Int64: i, Valid: i > 0}
}
}
// Check if a disk was added (or maybe removed?)
if strings.Contains(change["type"], "config.hardware.device") &&
strings.Contains(event.CloudEvent.Data.FullFormattedMessage, ".vmdk") {
// TODO - recalculate total disk size
h.Logger.Debug("Detected config change for VM disk")
}
}
// Only create a database record if we found one of the config changes we were interested in
@@ -143,7 +151,7 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string
for _, change := range changes {
// Trim any extra spaces and skip empty lines
change = strings.TrimSpace(change)
h.Logger.Debug("Processing config change element", "substring", change)
//h.Logger.Debug("Processing config change element", "substring", change)
if change == "" {
continue
}
@@ -156,7 +164,7 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string
"type": match[1], // config type
"newValue": match[2], // new value after -> or <-
}
h.Logger.Debug("Adding new entry to output", "map", changeMap)
//h.Logger.Debug("Adding new entry to output", "map", changeMap)
result = append(result, changeMap)
} else {
h.Logger.Warn("No regex matches for string", "input", change)