Unverified Commit e6be4989 authored by Luc Didry's avatar Luc Didry
Browse files

Allow to activate pending lists with sympa.pl

- Small change to --open_list to let it handle pending lists
- Add --show_pending_lists=robot option to print pending lists (with some
  informations)

Fix #637
parent f55e49b1
......@@ -87,7 +87,7 @@ unless (
'send_digest', 'keep_digest',
'upgrade_config_location', 'role=s',
'dump_users', 'restore_users',
'open_list=s',
'open_list=s', 'show_pending_lists=s'
)
) {
pod2usage(-exitval => 1, -output => \*STDERR);
......@@ -1066,9 +1066,13 @@ elsif ($main::options{'sync_list_db'}) {
exit 1;
}
my $mode = 'open';
$mode = 'install' if $current_list->{'admin'}{'status'} eq 'pending';
my $spindle = Sympa::Spindle::ProcessRequest->new(
context => $robot_id,
action => 'open_list',
mode => $mode,
current_list => $current_list,
sender => Sympa::get_address($robot_id, 'listmaster'),
scenario_context => {skip => 1},
......@@ -1078,6 +1082,27 @@ elsif ($main::options{'sync_list_db'}) {
exit 1;
}
exit 0;
} elsif ($main::options{'show_pending_lists'}) {
my $all_lists = Sympa::List::get_lists(
$main::options{'show_pending_lists'},
'filter' => ['status' => 'pending']
);
if (@{$all_lists}) {
print "Pending lists:\n";
foreach my $list (@$all_lists) {
printf "%s@%s\n subject: %s\n creator: %s\n date: %s\n",
$list->{'name'},
$main::options{'show_pending_lists'},
$list->{'admin'}{'subject'},
$list->{'admin'}{'creation'}{'email'},
$list->{'admin'}{'creation'}{'date_epoch'};
}
} else {
printf "No pending list for robot %s\n",
$main::options{'show_pending_lists'};
}
exit 0;
}
die 'Unknown option';
......@@ -1253,6 +1278,7 @@ S<[ C<--purge_list>=I<list>[I<@robot>] ]>
S<[ C<--lowercase> ]> S<[ C<--make_alias_file> ]>
S<[ C<--dump_users> C<--list>=I<list>@I<domain>|ALL [ C<--role>=I<roles> ] ]>
S<[ C<--restore_users> C<--list>=I<list>@I<domain>|ALL [ C<--role>=I<roles> ] ]>
S<[ C<--show_pending_lists>=I<robot> ]>
=head1 DESCRIPTION
......@@ -1415,6 +1441,10 @@ users to DB (dump files in the list directory are imported).
Remove the list (remove archive, configuration files, users and owners in admin table. Restore is not possible after this operation.
=item C<--show_pending_lists>=I<robot>
Print all pending lists for the robot, with informations.
=item C<--reload_list_config>
[ C<--list=>I<mylist>@I<mydom> ] [ C<--robot=>I<mydom> ]
......
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