Merge pull request #810 from Icinga:feature/adds_supress_messages_to_disable_untrusted_certificates

Feature: Adds support to suppress messages for Disable-IcingaUntrustedCertificateValidation

Adds support to suppress messages for Disable-IcingaUntrustedCertificateValidation
This commit is contained in:
Lord Hepipud 2025-04-23 12:38:55 +02:00 committed by GitHub
commit 647cedbdf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 6 deletions

View file

@ -26,6 +26,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#796](https://github.com/Icinga/icinga-powershell-framework/issues/796) [#798](https://github.com/Icinga/icinga-powershell-framework/issues/798) Fixes an issue with the new check handling, which did not properly convert values from checks to the correct performance data values and base values in some cases * [#796](https://github.com/Icinga/icinga-powershell-framework/issues/796) [#798](https://github.com/Icinga/icinga-powershell-framework/issues/798) Fixes an issue with the new check handling, which did not properly convert values from checks to the correct performance data values and base values in some cases
* [#797](https://github.com/Icinga/icinga-powershell-framework/issues/797) Fixes plugins throwing `UNKNOWN` in case `-TresholdInterval` is used for Metrics over Time, when checks are newly registered and checked, before the first MoT is executed and collected * [#797](https://github.com/Icinga/icinga-powershell-framework/issues/797) Fixes plugins throwing `UNKNOWN` in case `-TresholdInterval` is used for Metrics over Time, when checks are newly registered and checked, before the first MoT is executed and collected
### Enhancements
* [#810](https://github.com/Icinga/icinga-powershell-framework/pull/810) Adds support to suppress messages for `Disable-IcingaUntrustedCertificateValidation`
## 1.13.3 (tbd) ## 1.13.3 (tbd)
* [#800](https://github.com/Icinga/icinga-powershell-framework/pull/800) Fixes an issue for certain plugins, like `Invoke-IcingaCheckProcess`, which reports unknown if MetricsOverTime is used for checks that do not write performance data * [#800](https://github.com/Icinga/icinga-powershell-framework/pull/800) Fixes an issue for certain plugins, like `Invoke-IcingaCheckProcess`, which reports unknown if MetricsOverTime is used for checks that do not write performance data

View file

@ -1,14 +1,22 @@
function Disable-IcingaUntrustedCertificateValidation() function Disable-IcingaUntrustedCertificateValidation()
{ {
param (
[switch]$SuppressMessages = $FALSE
);
try { try {
[System.Net.ServicePointManager]::CertificatePolicy = $null; [System.Net.ServicePointManager]::CertificatePolicy = $null;
if ($SuppressMessages -eq $FALSE) {
Write-IcingaConsoleNotice 'Successfully disabled untrusted certificate validation for this shell instance'; Write-IcingaConsoleNotice 'Successfully disabled untrusted certificate validation for this shell instance';
}
} catch { } catch {
if ($SuppressMessages -eq $FALSE) {
Write-IcingaConsoleError ( Write-IcingaConsoleError (
[string]::Format( [string]::Format(
'Failed to disable untrusted certificate policy: {0}', $_.Exception.Message 'Failed to disable untrusted certificate policy: {0}', $_.Exception.Message
) )
); );
} }
}
} }