summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2011-10-03 22:36:52 +0000
committermark <mark>2011-10-03 22:36:52 +0000
commit7d8bc7cdd5bd9f5578701d16874a2cbb0c336106 (patch)
tree146b7aeea9ca51d2ae830e26bda5e842ce6015ba
parentcd3ed01671d5e1f9332c494abbf4bb110aabe1e3 (diff)
fix stdin options on shellcommands export, from #831
-rw-r--r--FS/FS/part_export/shellcommands.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm
index 4bf273ec8..4d603cbd2 100644
--- a/FS/FS/part_export/shellcommands.pm
+++ b/FS/FS/part_export/shellcommands.pm
@@ -473,13 +473,17 @@ sub shellcommands_queue {
}
sub ssh_cmd { #subroutine, not method
- # XXX shouldn't this use $opt->{'stdin_string'} at some point?
use Net::OpenSSH;
my $opt = { @_ };
my $ssh = Net::OpenSSH->new($opt->{'user'}.'@'.$opt->{'host'});
die "Couldn't establish SSH connection: ". $ssh->error if $ssh->error;
- my ($output, $errput) = $ssh->capture2($opt->{'command'});
+
+ my $ssh_opt = {};
+ $ssh_opt->{'stdin_data'} = $opt->{'stdin_string'}
+ if exists($opt->{'stdin_string'});
+ my ($output, $errput) = $ssh->capture2($ssh_opt, $opt->{'command'});
die "Error running SSH command: ". $ssh->error if $ssh->error;
+
if ($errput && $opt->{'ignored_errors'} && length($opt->{'ignored_errors'})) {
my @ignored_errors = split('\n',$opt->{'ignored_errors'});
foreach my $ignored_error ( @ignored_errors ) {