feat: added storage data to crawler output

This commit is contained in:
David Allen 2025-05-03 16:56:36 -06:00
parent a62f74dbdd
commit 90985f4599
Signed by: towk
GPG key ID: 0430CDBE22619155
2 changed files with 106 additions and 1 deletions

View file

@ -121,6 +121,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) ([]map[strin
var (
systems []crawler.InventoryDetail
managers []crawler.Manager
storage []crawler.Storage
config = crawler.CrawlerConfig{
URI: uri,
CredentialStore: params.SecretStore,
@ -140,8 +141,14 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) ([]map[strin
log.Error().Err(err).Str("uri", uri).Msg("failed to crawl BMC for managers")
}
storage, err = crawler.CrawlBMCForStorage(config)
if err != nil {
log.Error().Err(err).Str("uri", uri).Msg("failed to crawl BMC for storage")
}
// we didn't find anything so do not proceed
if len(systems) == 0 && len(managers) == 0 {
if len(systems) == 0 && len(managers) == 0 && len(storage) == 0 {
log.Warn().Msg("no inventory details found")
continue
}
@ -162,6 +169,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) ([]map[strin
"RediscoverOnUpdate": false,
"Systems": systems,
"Managers": managers,
"Storage": storage,
"SchemaVersion": 1,
}