#!/home/product/code/webui-perl/bin/perl -T -I /home/product/code/firmware/current/lib/perl5
#SUDOER_USERS: nobody
#SUDOER_RUNAS_USERS: root, mta
#SUDOER_TAGS: NOPASSWD, EXEC
use warnings;
use strict;
use Barracuda::Sudo::Lib;

###############################################################################

=pod

=head1 NAME

barracuda_raid_rebuild

=head1 DESCRIPTION

Wraps calls to /usr/local/bin/barracuda_raid.pl with the rebuild arg. Takes the unit and disk as args.

=cut

###############################################################################

my $path = "/usr/local/bin/barracuda_raid.pl";
die 'Execution file ' . $path . 'does not exist' if ! -f $path;

my @argv = get_argv(qr/^\d+$/, qr/^\d+$/);
my $cmd = [$path, 'rebuild', "unit=$argv[0]", "disk=$argv[1]"];
system_succeed($cmd);

