mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Added check for output directory for collect
This commit is contained in:
parent
4cc3f7f7ac
commit
77b6a9ba7b
1 changed files with 14 additions and 10 deletions
|
|
@ -129,6 +129,9 @@ func CollectInventory(scannedResults *[]ScannedAsset, params *CollectParams) err
|
|||
|
||||
// write JSON data to file if output path is set using hive partitioning strategy
|
||||
if outputPath != "" {
|
||||
// make directory if it does exists
|
||||
exists, err := util.PathExists(outputPath)
|
||||
if err == nil && !exists {
|
||||
err = os.MkdirAll(outputPath, 0o644)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to make directory for output")
|
||||
|
|
@ -146,6 +149,7 @@ func CollectInventory(scannedResults *[]ScannedAsset, params *CollectParams) err
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add all endpoints to smd
|
||||
err = smdClient.AddRedfishEndpoint(data, headers)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue