Subject: The mailing list for listmasters using Sympa
List archive
- From: Steve Rich <address@concealed>
- To: "address@concealed" <address@concealed>
- Subject: [sympa-users] sympa.pl --change_user_email bugged
- Date: Tue, 26 Jan 2016 17:29:17 +0000
Hi,
Has anyone else tried using the —change_user_email option with sympa.pl in version 6.2.13? I swear that I remember using it when we were running 6.2.3 and it worked flawlessly but now I’m getting the following error in the
log:
Jan 25 17:13:46 lists-app-01 sympa[46547]: err main::#503 > Sympa::Admin::change_user_email#1737 > Sympa::User::moveto#155 No email
Jan 25 17:13:46 lists-app-01 sympa[46547]: err main::#503 > Sympa::Admin::change_user_email#1738 Update failed
Tracing that through the process, I found the following in sympa.pl:
foreach my $robot (Sympa::List::get_robots()) {
printf STDOUT "Doing processing for virtual robot %s...\n", $robot;
my ($status, $failed_for) = Sympa::Admin::change_user_email(
current_email => $main::options{'current_email'},
new_email => $main::options{'new_email'},
robot => $robot
);
unless (defined $status) {
printf STDERR
"Failed to change user email address in virtual robot %s'}\n",
$robot;
exit 1;
}
foreach my $failed_list (@$failed_for) {
printf STDERR
"Failed to change user email address for list %s'}\n",
$failed_list->{'name'};
}
}
Digging into Sympa::Admin::change_user_email, I found the following:
## Update User_table and remove existing entry first (to avoid duplicate
## entries)
my $oldu = Sympa::User->new($in{'new_email'});
$oldu->expire if $oldu;
my $u = Sympa::User->new($in{'current_email'});
unless ($u and $u->moveto($in{'new_mail'})) {
$log->syslog('err', 'Update failed');
return undef;
}
I patched the typo in the highlighted line from new_mail to new_email and the process got a little further. Now it’s presenting an error in the Sympa::User::moveto subroutine.
sub moveto {
my $self = shift;
my $newemail = Sympa::Tools::Text::canonic_email(shift);
unless (defined $newemail) {
$log->syslog('err', 'No email');
return undef;
}
if ($self->email eq $newemail) {
return 0;
}
push @sth_stack, $sth;
unless (
$sth = do_prepared_query(
q{UPDATE user_table
SET email_user = ?
WHERE email_user = ?},
$newemail, $self->email
)
and $sth->rows
) {
$log->syslog('err', 'Can\'t move user %s to %s', $self, $newemail);
$sth = pop @sth_stack;
return undef;
}
$sth = pop @sth_stack;
$self->{'email'} = $newemail;
return 1;
}
In this case, do_prepared_query is not defined in this module as a subroutine but is a function of the Sympa::Databasemanager package via Sympa::Database.
Does anyone have a suggested patch to get this working again because we desperately need this functionality for some upcoming changes to our mail infrastructure.
Thanks,
Steve
- [sympa-users] sympa.pl --change_user_email bugged, Steve Rich, 01/26/2016
Archive powered by MHonArc 2.6.19+.