X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fstatus_shellcommands.pm;h=c5200ec507b32f61a0176d49e04b509ae2efe280;hp=88ddad7f59d50e1c65a570310b4f24d4bb5d98e7;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=e11671629ab9738a106c92d291c4a1e1b084f0fb diff --git a/FS/FS/part_export/status_shellcommands.pm b/FS/FS/part_export/status_shellcommands.pm index 88ddad7f5..c5200ec50 100644 --- a/FS/FS/part_export/status_shellcommands.pm +++ b/FS/FS/part_export/status_shellcommands.pm @@ -3,6 +3,7 @@ use base qw( FS::part_export::shellcommands ); use vars qw( %info ); use Tie::IxHash; +use String::ShellQuote; tie my %options, 'Tie::IxHash', 'user' => { label=>'Remote username', default=>'root' }, @@ -12,9 +13,13 @@ tie my %options, 'Tie::IxHash', 'spam_tag2_level' => { label=>'Spam set tag2 level command', }, 'spam_kill_level' => { label=>'Spam set kill level command', }, - 'ignore_all_output' => { - label => 'Ignore all output and errors from the command', - type => 'checkbox', + 'fail_on_output' => { + label => 'Treat any output from the command as an error', + type => 'checkbox', + }, + 'ignore_all_errors' => { + label => 'Ignore all errors from the command', + type => 'checkbox', }, ; @@ -38,10 +43,35 @@ sub _export_unsuspend {} sub export_setstatus { my($self, $svc_acct, $hashref) = @_; - $self->_export_command('spam_enable', $svc_acct->email); + for (qw( spam_tag2_level spam_kill_level )) { + $hashref->{$_} =~ /^\d+(\.\d+)?$/ or return "illegal $_"; + } + + my @shellargs = ( + $svc_acct->svcnum, + user => $self->option('user') || 'root', + host => $self->machine, + #stdin_string => $stdin_string, + fail_on_output => $self->option('fail_on_output'), + ignore_all_errors => $self->option('ignore_all_errors'), + #ignored_errors => $self->option('ignored_errors') || '', + ); - $self->_export_command('spam_tag2_level', $svc_acct->email, $hashref->{'spam_tag2_level'} ); - $self->_export_command('spam_kill_level', $svc_acct->email, $hashref->{'spam_kill_level'} ); + $self->shellcommands_queue( @shellargs, 'command' => + $self->option('spam_enable'). ' '. + shell_quote($svc_acct->email) + ) + || $self->shellcommands_queue( @shellargs, 'command' => + $self->option('spam_tag2_level'). ' '. + shell_quote($svc_acct->email). ' '. + $hashref->{'spam_tag2_level'} + ) + || $self->shellcommands_queue( @shellargs, 'command' => + $self->option('spam_kill_level'). ' '. + shell_quote($svc_acct->email). ' '. + $hashref->{'spam_kill_level'} + ) + ; }