From 31491f8624aba9d38ce17f3dbaad9960599e9266 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 24 Mar 2021 11:39:06 +0100 Subject: [PATCH] marsadm: silence annoying warning at cron --- userspace/marsadm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/userspace/marsadm b/userspace/marsadm index 6a52c8d0..0d82962a 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -2992,7 +2992,7 @@ sub check_sync_finished { } sub check_primary { - my ($cmd, $res, $no_designated, $no_fail) = @_; + my ($cmd, $res, $no_designated, $no_fail, $no_warn) = @_; my $fail = 0; my $lnk = "$mars/resource-$res/actual-$host/is-primary"; my $is_primary = get_link($lnk, 1); @@ -3000,13 +3000,13 @@ sub check_primary { $is_primary = device_exists($res); } unless ($is_primary) { - lwarn "For operation '$cmd' I need to be primary\n"; + lwarn "For operation '$cmd' I need to be primary\n" unless $no_warn; $fail++; } if ($no_designated) { my $primary = _get_designated_primary($res); unless ($primary eq $host) { - lwarn "For operation '$cmd', I also must be the designated primary\n"; + lwarn "For operation '$cmd', I also must be the designated primary\n" unless $no_warn; } } unless (defined($no_fail) && $no_fail) { @@ -5365,7 +5365,8 @@ sub logrotate_res { if ($force) { lwarn "operation $cmd --force is DANGEROUS\n"; } else { - return if check_primary($cmd, $res, 0, 1); + my $no_warn = ($cmd =~ /cron/); + return if check_primary($cmd, $res, 0, 1, $no_warn); } my $log_glob = "$mars/resource-$res/log-*-$host"; lprint "get logfiles '$log_glob'\n";