Add support for storage command and crawler output

Partially addresses issue #3 by adding a simple `magellan list devices` command to list storage devices. To close the issue, this PR still requires including storage device information in the `crawler`'s output.

Reviewed-on: towk/magellan-ng#5
This commit is contained in:
David Allen 2025-05-03 16:58:17 -06:00
parent f02c29917a
commit a6c445b86f
Signed by: towk
GPG key ID: 0430CDBE22619155
20 changed files with 449 additions and 18 deletions

View file

@ -97,6 +97,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
var (
systems []crawler.InventoryDetail
managers []crawler.Manager
storage []crawler.Storage
config = crawler.CrawlerConfig{
URI: uri,
CredentialStore: params.SecretStore,
@ -116,6 +117,11 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
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 util.IsEmpty(systems) && util.IsEmpty(managers) {
continue
@ -144,6 +150,7 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams, store secret
"RediscoverOnUpdate": false,
"Systems": systems,
"Managers": managers,
"Storage": storage,
"SchemaVersion": 1,
}