diff --git a/internal/vcenter/vcenter.go b/internal/vcenter/vcenter.go index 1568ae8..26422dc 100644 --- a/internal/vcenter/vcenter.go +++ b/internal/vcenter/vcenter.go @@ -82,6 +82,7 @@ func (v *Vcenter) Login(vUrl string) error { } func (v *Vcenter) Logout() error { + v.Logger.Debug("vcenter logging out") return v.client.Logout(v.ctx) } @@ -203,5 +204,6 @@ func (v *Vcenter) FindVMByIDWithDatacenter(vmID string, dcID string) (*VmPropert return nil, fmt.Errorf("failed to retrieve VM: %w", err) } - return nil, fmt.Errorf("VM with ID %s not found in any datacenter", vmID) + v.Logger.Info("Unable to find vm in datacenter", "vm_id", vmID, "datacenter_id", dcID) + return &VmProperties{}, nil } diff --git a/server/handler/vmCreate.go b/server/handler/vmCreate.go index 555f566..0e91adc 100644 --- a/server/handler/vmCreate.go +++ b/server/handler/vmCreate.go @@ -88,6 +88,7 @@ func (h *Handler) VmCreate(w http.ResponseWriter, r *http.Request) { } // Create an instance of CreateInventoryParams + h.Logger.Debug("Creating database parameters") params := queries.CreateInventoryParams{ Name: vm.CloudEvent.Data.VM.Name, Vcenter: vm.CloudEvent.Source,