dont query vm folder path unless we need to
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user