logging adjustments
This commit is contained in:
@@ -258,7 +258,7 @@ func getFieldValue(field reflect.Value) interface{} {
|
|||||||
if ni.Valid {
|
if ni.Valid {
|
||||||
return ni.Int64
|
return ni.Int64
|
||||||
}
|
}
|
||||||
return 0
|
return -1
|
||||||
case sql.NullFloat64:
|
case sql.NullFloat64:
|
||||||
nf := field.Interface().(sql.NullFloat64)
|
nf := field.Interface().(sql.NullFloat64)
|
||||||
if nf.Valid {
|
if nf.Valid {
|
||||||
|
@@ -52,14 +52,14 @@ func (c *CronTask) RunVcenterPoll(ctx context.Context, logger *slog.Logger) erro
|
|||||||
|
|
||||||
// Skip any vCLS VMs
|
// Skip any vCLS VMs
|
||||||
if strings.HasPrefix(vm.Name(), "vCLS-") {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - should we compare the UUID as well?
|
// TODO - should we compare the UUID as well?
|
||||||
for _, dbvm := range results {
|
for _, dbvm := range results {
|
||||||
if dbvm.VmId.String == vm.Reference().Value {
|
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
|
matchFound = true
|
||||||
|
|
||||||
// Get the full VM object
|
// 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 {
|
if dbvm.VmUuid.String == vmObj.Config.Uuid {
|
||||||
// TODO - compare database against current values, create update record if not matching
|
// TODO - compare database against current values, create update record if not matching
|
||||||
err = c.UpdateVmInventory(vmObj, vc, ctx, dbvm)
|
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
|
break
|
||||||
|
@@ -67,7 +67,7 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else {
|
} 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,
|
"id", event.CloudEvent.ID,
|
||||||
"vm", event.CloudEvent.Data.VM.Name, "user_name", event.CloudEvent.Data.UserName)
|
"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 {
|
if err := json.Unmarshal(*event.CloudEvent.Data.ConfigSpec, &testConfig); err != nil {
|
||||||
h.Logger.Warn("unable to decode ConfigSpec json", "error", err)
|
h.Logger.Warn("unable to decode ConfigSpec json", "error", err)
|
||||||
} else {
|
} else {
|
||||||
h.Logger.Debug("successfully decoded ConfigSpec JSON")
|
//h.Logger.Debug("successfully decoded ConfigSpec JSON")
|
||||||
}
|
}
|
||||||
|
|
||||||
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
|
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
|
||||||
|
Reference in New Issue
Block a user