Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions internal/services/v1/collector_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,24 @@ func (f *collectorWorkFactory) Build(creds models.Credentials) work.WorkBuilder2

if result.HasErrors() {
log.Errorw("schema validation errors", "errors", result.Errors)
r.Err = fmt.Errorf("schema validation failed: %v", result.Errors)
r.Err = result.Error()
for _, e := range result.Errors {
if e.Code == "MISSING_CLUSTER" || e.Code == "NO_VMS" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you're not using the const values from the package?
e.g duckdb_parser.CodeNoVMs

r.Err = fmt.Errorf("%w — this may indicate insufficient vCenter permissions; VMware can return incomplete inventory without an explicit permission error; verify your vCenter user has read-only access to all clusters and hosts", r.Err)
break
}
}
return r, r.Err
}

if len(result.Warnings) > 0 {
log.Warnw("schema validation warnings", "warnings", result.Warnings)
for _, w := range result.Warnings {
if w.Code == "EMPTY_NETWORKS" || w.Code == "EMPTY_HOSTS" || w.Code == "EMPTY_DATASTORES" {
log.Warnw("schema validation warning (may indicate insufficient permissions)", "code", w.Code, "message", w.Message)
} else {
log.Warnw("schema validation warning", "code", w.Code, "message", w.Message)
}
}
}

log.Info("sqlite data successfully ingested into duckdb")
Expand Down
16 changes: 14 additions & 2 deletions internal/services/v2/collector_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,24 @@ func (f *vCenterCollectorWorkFactory) Build() work.WorkBuilder2[models.Collector

if result.HasErrors() {
log.Errorw("schema validation errors", "errors", result.Errors)
r.Err = fmt.Errorf("schema validation failed: %v", result.Errors)
r.Err = result.Error()
for _, e := range result.Errors {
if e.Code == "MISSING_CLUSTER" || e.Code == "NO_VMS" {
r.Err = fmt.Errorf("%w — this may indicate insufficient vCenter permissions; VMware can return incomplete inventory without an explicit permission error; verify your vCenter user has read-only access to all clusters and hosts", r.Err)
break
}
}
return r, r.Err
}

if len(result.Warnings) > 0 {
log.Warnw("schema validation warnings", "warnings", result.Warnings)
for _, w := range result.Warnings {
if w.Code == "EMPTY_NETWORKS" || w.Code == "EMPTY_HOSTS" || w.Code == "EMPTY_DATASTORES" {
log.Warnw("schema validation warning (may indicate insufficient permissions)", "code", w.Code, "message", w.Message)
} else {
log.Warnw("schema validation warning", "code", w.Code, "message", w.Message)
}
}
}

log.Info("sqlite data successfully ingested into duckdb")
Expand Down
Loading