fix(lib/core): Allow Cache-Key deletion with NULL

This commit is contained in:
Fabian Thomys 2025-09-16 13:50:22 +02:00
parent 854ef78f91
commit 44700e4bd2
2 changed files with 11 additions and 0 deletions

View file

@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#814](https://github.com/Icinga/icinga-powershell-framework/pull/814) Fixes random chars function to truly generate unpredictable character sequences and to replace `Get-Random` which is not entirely secure
* [#815](https://github.com/Icinga/icinga-powershell-framework/pull/815) Fixes a possible crash for `Test-IcingaAddTypeExist`, causing the Icinga for Windows installation to fail when third party components are checked which are malfunctioning
* [#829](https://github.com/Icinga/icinga-powershell-framework/pull/829) Fixes `Set-IcingaCacheData` to properly remove cache files in case `$null` is passed as value
## 1.13.3 (2025-05-08)

View file

@ -38,6 +38,16 @@ function Set-IcingaCacheData()
$CacheTmpFile = [string]::Format('{0}.tmp', $CacheFile);
$cacheData = @{ };
if ($null -eq $Value) {
if (Test-Path $CacheTmpFile) {
Remove-ItemSecure -Path $CacheTmpFile -Retries 5 -Force | Out-Null;
}
if (Test-Path $CacheFile) {
Remove-ItemSecure -Path $CacheFile -Retries 5 -Force | Out-Null;
}
return;
}
if ((Test-IcingaCacheDataTempFile -Space $Space -CacheStore $CacheStore -KeyName $KeyName)) {
Copy-IcingaCacheTempFile -CacheFile $CacheFile -CacheTmpFile $CacheTmpFile;
}