From feec1c58240b1a13d6fd7a5246e7ebd5a5defa2a Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sun, 12 Jul 2009 09:33:08 -0400 Subject: [PATCH] Make new function to pull English translations for fallthrough checks. --- check_postgres.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/check_postgres.pl b/check_postgres.pl index a092b25a3..9b99b62a2 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -846,6 +846,14 @@ sub msgn { ## no critic return msg(@_) . "\n"; } +sub msg_en { + + my $name = shift || '?'; + + return $msg{'en'}{$name}; + +} ## end of msg_en + ## Everything from here on out needs psql, so find and verify a working version: if ($NO_PSQL_OPTION) { delete $opt{PSQL} and ndie msg('opt-psql-restrict'); @@ -2310,7 +2318,7 @@ sub check_backends { ## If we cannot connect because of too many clients, we treat as a critical error if (exists $info->{fatalregex}) { my $regmsg = msg('backends-po'); - my $regmsg2 = msg('backends-po', 'en'); + my $regmsg2 = msg_en('backends-po'); if ($info->{fatalregex} =~ /$regmsg/ or $info->{fatalregex} =~ /$regmsg2/) { add_critical msg('backends-fatal'); return; @@ -5688,7 +5696,7 @@ sub check_checkpoint { my $regex = msg('checkpoint-po'); if ($res !~ /$regex\s*(.+)/) { ## no critic (ProhibitUnusedCapture) ## Just in case, check the English one as well - $regex = msg('checkpoint-po', 'en'); + $regex = msg_en('checkpoint-po'); if ($res !~ /$regex\s*(.+)/) { ndie msg('checkpoint-noregex', $dir); } -- 2.39.5