fix: resolve PSScriptAnalyzer ParseError and StrictMode Count issue
This commit is contained in:
@@ -57,8 +57,8 @@ if (-not (Test-Path $VmrunPath -PathType Leaf)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cutoff = (Get-Date).AddHours(-$MaxAgeHours)
|
$cutoff = (Get-Date).AddHours(-$MaxAgeHours)
|
||||||
$orphans = Get-ChildItem -Path $CloneBaseDir -Directory -ErrorAction SilentlyContinue |
|
$orphans = @(Get-ChildItem -Path $CloneBaseDir -Directory -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $_.LastWriteTime -lt $cutoff }
|
Where-Object { $_.LastWriteTime -lt $cutoff })
|
||||||
|
|
||||||
if (-not $orphans) {
|
if (-not $orphans) {
|
||||||
Write-Host "[Cleanup] No orphaned VMs found (threshold: $MaxAgeHours h)."
|
Write-Host "[Cleanup] No orphaned VMs found (threshold: $MaxAgeHours h)."
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ function Remove-OldJobDirs {
|
|||||||
Where-Object { $_.LastWriteTime -lt $cutoff }
|
Where-Object { $_.LastWriteTime -lt $cutoff }
|
||||||
|
|
||||||
if (-not @($old).Count) {
|
if (-not @($old).Count) {
|
||||||
Write-Host "[RetentionPolicy] $Label: nothing to purge (cutoff: $($cutoff.ToString('yyyy-MM-dd')))."
|
Write-Host "[RetentionPolicy] ${Label}: nothing to purge (cutoff: $($cutoff.ToString('yyyy-MM-dd')))."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user