Skip to content

Commit 17367a0

Browse files
committed
fix tenant count output
1 parent 2c42a1b commit 17367a0

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

m365/image/run_container.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ if ($LASTEXITCODE -gt 0) {
6363
}
6464

6565
$OutPathPrefix = "$($Env:REPORT_OUTPUT)/$(Get-Date -Format "yyyy/MM/dd")/"
66+
$TenantCount = 0
6667
$Files = @()
67-
$Errors = @()
68+
$ErrorTenants = @()
6869

6970
Foreach ($tenantConfig in $(Get-ChildItem 'input\')) {
7071
try {
7172
$Organization = $tenantConfig.BaseName.split("_")[0]
73+
$TenantCount += 1
7274
Write-Output "Running ScubaGear for $($tenantConfig.BaseName)"
7375

7476
$Params = @{
@@ -109,7 +111,7 @@ Foreach ($tenantConfig in $(Get-ChildItem 'input\')) {
109111
Remove-Item $ResultsFile
110112

111113
} catch {
112-
$Errors += $Organization
114+
$ErrorTenants += $Organization
113115
Write-Output "Error occurred while running on $($Organization)"
114116
Write-Output $_
115117
}
@@ -132,9 +134,9 @@ if ("true" -ne $Env:SKIP_AUDIT_LOG) {
132134
Write-Output "Uploaded audit log to $OutPathPrefix$AuditFile"
133135
}
134136

135-
Write-Output "Finished running on $($Files.Count) tenants. Encountered $($Errors.Count) Errors"
136-
if ($Errors.Count -gt 0) {
137-
Write-Output "Tenants with errors:`n $($Errors -join "`n ")"
137+
Write-Output "Finished running on $TenantsCount tenants. Encountered $($ErrorTenants.Count) ErrorTenants"
138+
if ($ErrorTenants.Count -gt 0) {
139+
Write-Output "Tenants with errors:`n $($ErrorTenants -join "`n ")"
138140
exit 1
139141
}
140142
exit 0

0 commit comments

Comments
 (0)