From 93ad1837113cca20139cb7e9fafbd750fb6e3251 Mon Sep 17 00:00:00 2001 From: Lewis Eason Date: Tue, 14 Jun 2016 12:00:25 +0100 Subject: [PATCH] Add functionality to support EL7 extended output On el7, yum will list all the packages available for update *after* the summary line, as well as in the transaction. At first I tried just checking for *2 lines in the output before failing with the bad signature, but this didn't seem quite as robust. --- check_yum | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/check_yum b/check_yum index 80fff37..ae934ac 100755 --- a/check_yum +++ b/check_yum @@ -262,6 +262,12 @@ class YumTester: cmd = "%s --security check-update" % YUM output = self.run(cmd) + output2 = "\n".join(output).split("\n\n") + + if len(output2) == 2: + extra_lines = output2[1].split("\n") + else: + extra_lines = [] re_security_summary_rhel5 = re.compile("Needed \d+ of \d+ packages, for security") re_security_summary_rhel6 = re.compile("\d+ package\(s\) needed for security, out of \d+ available") @@ -301,7 +307,10 @@ class YumTester: number_other_updates = number_total_updates - number_security_updates - if len(output) > number_total_updates + 25: + relevant_lines = len(output) - len(extra_lines) + expected_lines = number_total_updates + 25 + + if relevant_lines > expected_lines: end(WARNING, "YUM output signature is larger than current known format, please make sure you have upgraded to the latest version of this plugin. If the problem persists, please contact the author for a fix") return number_security_updates, number_other_updates