Skip to content

Commit

Permalink
vcenterreceiver ResourcePool Object client call will not error on not…
Browse files Browse the repository at this point in the history
… found error
  • Loading branch information
StefanKurek committed Jun 28, 2024
1 parent b927206 commit f5f74ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions receiver/vcenterreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ func (vc *vcenterClient) ResourcePoolInventoryListObjects(
for _, dc := range dcs {
vc.finder.SetDatacenter(dc)
rps, err := vc.finder.ResourcePoolList(ctx, "*")
if err != nil {
var notFoundErr *find.NotFoundError
if err != nil && !errors.As(err, &notFoundErr) {
return nil, fmt.Errorf("unable to retrieve ResourcePools with InventoryLists for datacenter %s: %w", dc.InventoryPath, err)
}
allRPools = append(allRPools, rps...)
Expand All @@ -261,12 +262,12 @@ func (vc *vcenterClient) VAppInventoryListObjects(
for _, dc := range dcs {
vc.finder.SetDatacenter(dc)
vApps, err := vc.finder.VirtualAppList(ctx, "*")
var notFoundErr *find.NotFoundError
if err == nil {
allVApps = append(allVApps, vApps...)
continue
}

var notFoundErr *find.NotFoundError
if !errors.As(err, &notFoundErr) {
return nil, fmt.Errorf("unable to retrieve vApps with InventoryLists for datacenter %s: %w", dc.InventoryPath, err)
}
Expand Down

0 comments on commit f5f74ae

Please sign in to comment.