logging adjustments
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-10-16 16:34:30 +11:00
parent b46369811b
commit c8ae94fb43
3 changed files with 7 additions and 5 deletions

View File

@@ -258,7 +258,7 @@ func getFieldValue(field reflect.Value) interface{} {
if ni.Valid {
return ni.Int64
}
return 0
return -1
case sql.NullFloat64:
nf := field.Interface().(sql.NullFloat64)
if nf.Valid {

View File

@@ -52,14 +52,14 @@ func (c *CronTask) RunVcenterPoll(ctx context.Context, logger *slog.Logger) erro
// Skip any vCLS VMs
if strings.HasPrefix(vm.Name(), "vCLS-") {
c.Logger.Debug("Skipping internal VM", "vm_name", vm.Name())
//c.Logger.Debug("Skipping internal VM", "vm_name", vm.Name())
continue
}
// TODO - should we compare the UUID as well?
for _, dbvm := range results {
if dbvm.VmId.String == vm.Reference().Value {
c.Logger.Debug("Found match for VM", "vm_name", dbvm.Name, "id", dbvm.VmId.String)
//c.Logger.Debug("Found match for VM", "vm_name", dbvm.Name, "id", dbvm.VmId.String)
matchFound = true
// Get the full VM object
@@ -78,6 +78,8 @@ func (c *CronTask) RunVcenterPoll(ctx context.Context, logger *slog.Logger) erro
if dbvm.VmUuid.String == vmObj.Config.Uuid {
// TODO - compare database against current values, create update record if not matching
err = c.UpdateVmInventory(vmObj, vc, ctx, dbvm)
} else {
c.Logger.Error("VM uuid doesn't match database record", "vm_name", dbvm.Name, "id", dbvm.VmId.String, "vc_uuid", vmObj.Config.Uuid, "db_uuid", dbvm.VmUuid.String)
}
break

View File

@@ -67,7 +67,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
})
return
} else {
h.Logger.Debug("Received event contains config change info", "source", event.CloudEvent.Source,
h.Logger.Info("Received event contains config change info", "source", event.CloudEvent.Source,
"id", event.CloudEvent.ID,
"vm", event.CloudEvent.Data.VM.Name, "user_name", event.CloudEvent.Data.UserName)
@@ -76,7 +76,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
if err := json.Unmarshal(*event.CloudEvent.Data.ConfigSpec, &testConfig); err != nil {
h.Logger.Warn("unable to decode ConfigSpec json", "error", err)
} else {
h.Logger.Debug("successfully decoded ConfigSpec JSON")
//h.Logger.Debug("successfully decoded ConfigSpec JSON")
}
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)