Skip to content

Commit e21011f

Browse files
authored
Merge pull request #269 from Icinga:fix/icinga_cache_permission_handling
Fix: Unhandled exception on Icinga Cache Fixes unhandled exception on `Set-IcingaCacheData`, as the `-ErrorAction Stop` argument was not set and therefor the function never halted on errors.
2 parents 1ab41f1 + e3867ec commit e21011f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
3232
* [#240](https://github.com/Icinga/icinga-powershell-framework/pull/240) While filtering for certain services with `Get-IcingaServices`, there were some attributes missing from the collection. These are now added resulting in always correct output data.
3333
* [#245](https://github.com/Icinga/icinga-powershell-framework/pull/245) Fixes loading of `.pfx` certificates by properly checking the file type
3434
* [#265](https://github.com/Icinga/icinga-powershell-framework/pull/265) Fixes `Test-Numeric` to now accept negative numeric values and als fixes errors, causing `.` to be allowed multiple times. `ConvertFrom-TimeSpan` now properly prints on negative values if the time provided is positive or negative and also prints microseconds as `us` in case the value is loer than `1ms`
35+
* [#269](https://github.com/Icinga/icinga-powershell-framework/pull/269) Fixes unhandled exception on `Set-IcingaCacheData`, as the `-ErrorAction Stop` argument was not set and therefor the function never halted on errors
3536

3637
## 1.4.1 (2021-03-10)
3738

lib/core/cache/Set-IcingaCacheData.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Set-IcingaCacheData()
4141
$cacheData = Get-IcingaCacheData -Space $Space -CacheStore $CacheStore;
4242
} else {
4343
try {
44-
New-Item -ItemType File -Path $CacheFile -Force | Out-Null;
44+
New-Item -ItemType File -Path $CacheFile -Force -ErrorAction Stop | Out-Null;
4545
} catch {
4646
Exit-IcingaThrowException -InputString $_.Exception -CustomMessage (Get-IcingaCacheDir) -StringPattern 'NewItemUnauthorizedAccessError' -ExceptionType 'Permission' -ExceptionThrown $IcingaExceptions.Permission.CacheFolder;
4747
Exit-IcingaThrowException -CustomMessage $_.Exception -ExceptionType 'Unhandled' -Force;

0 commit comments

Comments
 (0)