Skip to content

Commit

Permalink
fix(main,vmware): display errors at the end of the main function and …
Browse files Browse the repository at this point in the history
…fix undefined probability in vmware
  • Loading branch information
bl4ko committed Feb 28, 2025
1 parent 4c098e3 commit a4d85f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cmd/netbox-ssot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func main() {
// Variable to store if the run was successful. If it wasn't we don't remove orphans.
successfullRun := true
// Variable to store failed sourcesFalse
encounteredErrors := map[string]bool{}
encounteredErrors := map[string]error{}

// Go through all sources and sync data
var wg sync.WaitGroup
Expand Down Expand Up @@ -104,7 +104,7 @@ func main() {
if err != nil {
ssotLogger.Error(sourceCtx, err)
successfullRun = false
encounteredErrors[sourceName] = true
encounteredErrors[sourceName] = err
return
}
ssotLogger.Infof(sourceCtx, "Successfully initialized source %s", constants.CheckMark)
Expand All @@ -115,7 +115,7 @@ func main() {
if err != nil {
successfullRun = false
ssotLogger.Error(sourceCtx, err)
encounteredErrors[sourceName] = true
encounteredErrors[sourceName] = err
return
}
ssotLogger.Infof(sourceCtx, "Source synced successfully %s", constants.CheckMark)
Expand Down Expand Up @@ -148,8 +148,8 @@ func main() {
seconds,
)
} else {
for source := range encounteredErrors {
ssotLogger.Infof(mainCtx, "%s syncing of source %s failed", constants.WarningSign, source)
for source, err := range encounteredErrors {
ssotLogger.Infof(mainCtx, "%s syncing of source %s failed with: %v", constants.WarningSign, source, err)
}
os.Exit(1)
}
Expand Down
7 changes: 5 additions & 2 deletions internal/source/vmware/vmware_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,11 @@ func (vc *VmwareSource) syncVM(
}

// vmVCPUs and vmMemory
vmVCPUs := vm.Config.Hardware.NumCPU
vmMemoryMB := vm.Config.Hardware.MemoryMB
var vmVCPUs, vmMemoryMB int32
if vm.Config != nil {
vmVCPUs = vm.Config.Hardware.NumCPU
vmMemoryMB = vm.Config.Hardware.MemoryMB
}

// DisksSize
// vmTotalDiskSizeMiB := int64(0)
Expand Down

0 comments on commit a4d85f0

Please sign in to comment.