From a6488ee6fb21c460d5fed496775eb1f7a94f29b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Fri, 24 Sep 2021 10:13:40 +0000 Subject: [PATCH] fix: groupdel: false positive in lock contention detection Groups that were containing 'lock' or 'retry' in their name would falsely trigger the /etc/passwd and /etc/group lock contention detection, due to their presence in the output of the system command, implying several retries that were not needed. --- lib/perl/OVH/Bastion/os.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/perl/OVH/Bastion/os.inc b/lib/perl/OVH/Bastion/os.inc index 915c9fe..f3b908f 100644 --- a/lib/perl/OVH/Bastion/os.inc +++ b/lib/perl/OVH/Bastion/os.inc @@ -47,9 +47,14 @@ sub _sys_autoretry { my $fnret; foreach my $try (1 .. 10) { $fnret = OVH::Bastion::execute(%params); - if ( ($fnret->value && $fnret->value->{'sysret'} == 10) - || ($fnret->value && $fnret->value->{'stdout'} && grep { /retry|lock/i } @{$fnret->value->{'stdout'}}) - || ($fnret->value && $fnret->value->{'stderr'} && grep { /retry|lock/i } @{$fnret->value->{'stderr'}})) + if ( + ($fnret->value && $fnret->value->{'sysret'} == 10) + || ( + ($fnret->value && $fnret->value->{'sysret'} != 0) + && ( ($fnret->value->{'stdout'} && grep { /retry|lock/i } @{$fnret->value->{'stdout'}}) + || ($fnret->value->{'stderr'} && grep { /retry|lock/i } @{$fnret->value->{'stderr'}})) + ) + ) { # too much concurrency, sleep a bit and retry warn_syslog('Too much concurrency on try '