mirror of https://github.com/schoebel/mars
marsadm: silence annoying warning at cron
This commit is contained in:
parent
6692189b7c
commit
31491f8624
|
@ -2992,7 +2992,7 @@ sub check_sync_finished {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_primary {
|
sub check_primary {
|
||||||
my ($cmd, $res, $no_designated, $no_fail) = @_;
|
my ($cmd, $res, $no_designated, $no_fail, $no_warn) = @_;
|
||||||
my $fail = 0;
|
my $fail = 0;
|
||||||
my $lnk = "$mars/resource-$res/actual-$host/is-primary";
|
my $lnk = "$mars/resource-$res/actual-$host/is-primary";
|
||||||
my $is_primary = get_link($lnk, 1);
|
my $is_primary = get_link($lnk, 1);
|
||||||
|
@ -3000,13 +3000,13 @@ sub check_primary {
|
||||||
$is_primary = device_exists($res);
|
$is_primary = device_exists($res);
|
||||||
}
|
}
|
||||||
unless ($is_primary) {
|
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++;
|
$fail++;
|
||||||
}
|
}
|
||||||
if ($no_designated) {
|
if ($no_designated) {
|
||||||
my $primary = _get_designated_primary($res);
|
my $primary = _get_designated_primary($res);
|
||||||
unless ($primary eq $host) {
|
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) {
|
unless (defined($no_fail) && $no_fail) {
|
||||||
|
@ -5365,7 +5365,8 @@ sub logrotate_res {
|
||||||
if ($force) {
|
if ($force) {
|
||||||
lwarn "operation $cmd --force is DANGEROUS\n";
|
lwarn "operation $cmd --force is DANGEROUS\n";
|
||||||
} else {
|
} 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";
|
my $log_glob = "$mars/resource-$res/log-*-$host";
|
||||||
lprint "get logfiles '$log_glob'\n";
|
lprint "get logfiles '$log_glob'\n";
|
||||||
|
|
Loading…
Reference in New Issue