Skip to content

Commit 073a363

Browse files
authored
improve output of sdnresource dump (#507)
# Description This pull request makes minor improvements to the SDN diagnostics scripts by enhancing logging and clarifying the handling of function output. The main changes focus on providing better feedback after resource dumps and ensuring that command outputs are not unnecessarily displayed. Enhancements to resource dump feedback and output handling: * Added a log message in `Invoke-SdnResourceDump` to indicate the number of files exported and the output directory, improving visibility into the results of the resource dump operation. (`src/modules/SdnDiag.NetworkController.psm1`) * Suppressed unwanted output from `Invoke-SdnResourceDump` in `Start-SdnDataCollection` by assigning the result to `$null`, ensuring cleaner script output. (`src/SdnDiagnostics.psm1`) # Change type - [ ] Bug fix (non-breaking change) - [ ] Code style update (formatting, local variables) - [x] New Feature (non-breaking change that adds new functionality without impacting existing) - [ ] Breaking change (fix or feature that may cause functionality impact) - [ ] Other # Checklist: - [x] My code follows the style and contribution guidelines of this project. - [x] I have tested and validated my code changes.
1 parent 772a681 commit 073a363

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/SdnDiagnostics.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ function Start-SdnDataCollection {
951951

952952
$slbStateInfo = Get-SdnSlbStateInformation @ncRestParams
953953
$slbStateInfo | ConvertTo-Json -Depth 100 | Out-File "$($OutputDirectory.FullName)\SlbState.Json"
954-
Invoke-SdnResourceDump @ncRestParams -OutputDirectory $OutputDirectory.FullName
954+
$null = Invoke-SdnResourceDump @ncRestParams -OutputDirectory $OutputDirectory.FullName
955955
Get-SdnNetworkControllerState -NetworkController $NetworkController -OutputDirectory $OutputDirectory.FullName -Credential $Credential @restCredParam
956956
}
957957

src/modules/SdnDiag.NetworkController.psm1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,6 +2459,11 @@ function Invoke-SdnResourceDump {
24592459
}
24602460
}
24612461
}
2462+
2463+
$files = Get-ChildItem -Path $outputDir.FullName
2464+
"Resource dump completed. {0} files exported to {1}" -f $files.Count, $outputDir.FullName | Trace-Output
2465+
2466+
return (Get-ChildItem -Path $outputDir.FullName)
24622467
}
24632468
catch {
24642469
$_ | Trace-Exception

0 commit comments

Comments
 (0)