diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 4f3d332..4c3aa88 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -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 * [#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) * [#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 diff --git a/lib/webserver/Disable-IcingaUntrustedCertificateValidation.psm1 b/lib/webserver/Disable-IcingaUntrustedCertificateValidation.psm1 index c53fad0..daa72d2 100644 --- a/lib/webserver/Disable-IcingaUntrustedCertificateValidation.psm1 +++ b/lib/webserver/Disable-IcingaUntrustedCertificateValidation.psm1 @@ -1,14 +1,22 @@ function Disable-IcingaUntrustedCertificateValidation() { + param ( + [switch]$SuppressMessages = $FALSE + ); + try { [System.Net.ServicePointManager]::CertificatePolicy = $null; - Write-IcingaConsoleNotice 'Successfully disabled untrusted certificate validation for this shell instance'; + if ($SuppressMessages -eq $FALSE) { + Write-IcingaConsoleNotice 'Successfully disabled untrusted certificate validation for this shell instance'; + } } catch { - Write-IcingaConsoleError ( - [string]::Format( - 'Failed to disable untrusted certificate policy: {0}', $_.Exception.Message - ) - ); + if ($SuppressMessages -eq $FALSE) { + Write-IcingaConsoleError ( + [string]::Format( + 'Failed to disable untrusted certificate policy: {0}', $_.Exception.Message + ) + ); + } } }