summaryrefslogtreecommitdiff
path: root/FS/FS/part_export/shellcommands.pm
diff options
context:
space:
mode:
authormark <mark>2009-07-28 02:12:50 +0000
committermark <mark>2009-07-28 02:12:50 +0000
commitcd2241d7ea1ce53a626adfd58a908cfd822c618c (patch)
tree6258ebc09af9c895f21013d67d0089ca2844f321 /FS/FS/part_export/shellcommands.pm
parent8d02e9450e5999da1015ac4c74f7a478716554f1 (diff)
Add no_queue option to shellcommands exports
Diffstat (limited to 'FS/FS/part_export/shellcommands.pm')
-rw-r--r--FS/FS/part_export/shellcommands.pm24
1 files changed, 19 insertions, 5 deletions
diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm
index c55fa36..e375302 100644
--- a/FS/FS/part_export/shellcommands.pm
+++ b/FS/FS/part_export/shellcommands.pm
@@ -65,6 +65,9 @@ tie my %options, 'Tie::IxHash',
'Radius group mapping to reason (via template user)',
type => 'textarea',
},
+ 'no_queue' => { label => 'Run command immediately',
+ type => 'checkbox',
+ },
;
%info = (
@@ -367,12 +370,23 @@ sub _export_replace {
my $command_string = eval(qq("$command"));
- $self->shellcommands_queue( $new->svcnum,
- user => $self->option('user')||'root',
- host => $self->machine,
- command => $command_string,
- stdin_string => $stdin_string,
+ my @ssh_cmd_args = (
+ user => $self->option('user') || 'root',
+ host => $self->machine,
+ command => $command_string,
+ stdin_string => $stdin_string,
);
+
+ if($self->options('no_queue')) {
+ # discard return value just like freeside-queued.
+ eval { ssh_cmd(@ssh_cmd_args) };
+ $error = $@;
+ return $error. ' ('. $self->exporttype. ' to '. $self->machine. ')'
+ if $error;
+ }
+ else {
+ $self->shellcommands_queue( $new->svcnum, @ssh_cmd_args );
+ }
}
#a good idea to queue anything that could fail or take any time