Commit b9d010d8 authored by olivier.salaun's avatar olivier.salaun
Browse files

[-bug]Prevent useless error messages in sympa.pl about unknown list and...

[-bug]Prevent useless error messages in sympa.pl about unknown list and unknown robot. This happens because we try to find out if a mail in the spool is a list message or a service message for a person. Now using 'just_try' options for List::new() and Conf::valir_robot().


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@7173 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent a3713a4b
......@@ -649,27 +649,30 @@ sub checkfiles {
}
## return 1 if the parameter is a known robot
## Valid options :
## 'just_try' : prevent error logs if robot is not valid
sub valid_robot {
my $robot = shift;
my $options = shift;
## Main host
return 1 if ($robot eq $Conf{'domain'});
## Missing etc directory
unless (-d $Conf{'etc'}.'/'.$robot) {
&Log::do_log('err', 'Robot %s undefined ; no %s directory', $robot, $Conf{'etc'}.'/'.$robot);
&Log::do_log('err', 'Robot %s undefined ; no %s directory', $robot, $Conf{'etc'}.'/'.$robot) unless ($options->{'just_try'});
return undef;
}
## Missing expl directory
unless (-d $Conf{'home'}.'/'.$robot) {
&Log::do_log('err', 'Robot %s undefined ; no %s directory', $robot, $Conf{'home'}.'/'.$robot);
&Log::do_log('err', 'Robot %s undefined ; no %s directory', $robot, $Conf{'home'}.'/'.$robot) unless ($options->{'just_try'});
return undef;
}
## Robot not loaded
unless (defined $Conf{'robots'}{$robot}) {
&Log::do_log('err', 'Robot %s was not loaded by this Sympa process', $robot);
&Log::do_log('err', 'Robot %s was not loaded by this Sympa process', $robot) unless ($options->{'just_try'});
return undef;
}
......
......@@ -268,13 +268,11 @@ sub new {
if ($listname =~ /^(\S+)-($list_check_regexp)$/) {
$listname = $1;
}
my $list = new List ($listname, $robot);
my $list = new List ($listname, $robot, {'just_try' => 1});
if ($list) {
$message->{'list'} = $list;
}else{
do_log('err', 'Could not create List object for list %s in robot %s', $listname, $robot);
# return undef;
}
}
}
# verify DKIM signature
if (&Conf::get_robot_conf($robot, 'dkim_feature') eq 'on'){
......
......@@ -1241,8 +1241,8 @@ sub DoFile {
if ( $message->{'md5_check'} ) {
# message contain a valid checksum, it comes from wwsympa, so
# mail it without other proceding unless it is for a valid list
return (&DoSendMessage ($message,$robot)) unless(&Conf::valid_robot($robot)) ;
return (&DoSendMessage ($message,$robot)) unless( new List ($listname, $robot));
return (&DoSendMessage ($message,$robot)) unless(&Conf::valid_robot($robot, {'just_try' => 1})) ;
return (&DoSendMessage ($message,$robot)) unless( new List ($listname, $robot, {'just_try' => 1}));
}
# setting log_level using conf unless it is set by calling option
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment