From a33455f343ee22172fec4ed1d575a7449358d5b9 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Fri, 13 Sep 2019 17:04:05 +0200 Subject: [PATCH] Fixed update list throwing unknown for 0 pending updates --- lib/plugins/Invoke-IcingaCheckUpdates.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugins/Invoke-IcingaCheckUpdates.psm1 b/lib/plugins/Invoke-IcingaCheckUpdates.psm1 index 7fd3cf4..4b2fbc4 100644 --- a/lib/plugins/Invoke-IcingaCheckUpdates.psm1 +++ b/lib/plugins/Invoke-IcingaCheckUpdates.psm1 @@ -47,8 +47,12 @@ function Invoke-IcingaCheckUpdates() $UpdateCount.AddCheck($IcingaCheck); $UpdatePackage = New-IcingaCheckPackage -Name 'Updates' -OperatorAnd -Verbose $Verbose -Checks @( - $UpdateCount, $UpdateList + $UpdateCount ); + if ($PendingCount -ne 0) { + $UpdatePackage.AddCheck($UpdateList); + } + exit (New-IcingaCheckResult -Name 'Pending Updates' -Check $UpdatePackage -NoPerfData $NoPerfData -Compile); }