]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor/SendFile.pm
Patch from Joe Atzberger that does several things:
[working/Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Trigger / Reactor / SendFile.pm
1 package   OpenILS::Application::Trigger::Reactor::SendFile;
2 use       OpenILS::Application::Trigger::Reactor;
3 use base 'OpenILS::Application::Trigger::Reactor';
4
5 # use OpenSRF::Utils::SettingsClient;
6 use OpenILS::Utils::RemoteAccount;
7
8 use strict;
9 use warnings;
10
11 sub ABOUT {
12     return <<ABOUT;
13
14 The SendFile Reactor Module attempts to transfer a file to a remote server via
15 SCP, FTP or SFTP.
16
17 No default template is assumed, and all information is expected to be gathered
18 by the Event Definition through event parameters:
19    ~ remote_host (required)
20    ~ remote_user
21    ~ remote_password
22    ~ remote_account
23    ~ remote_filename
24    ~ ssh_privatekey
25    ~ ssh_publickey
26    ~ type (FTP, SFTP or SCP -- default FTP)
27    ~ port
28    ~ debug
29
30 The processed template is passed as "content" with the other params to
31 OpenILS::Utils::RemoteAccount.  See perldoc OpenILS::Utils::RemoteAccount for more.
32
33 TODO: allow config.remote_account.id to specify options.
34 ABOUT
35 }
36
37 sub handler {
38     my $self = shift;
39     my $env  = shift;
40     my $params = $env->{params};
41
42     $params->{content} = $self->run_TT($env) or return;
43     my $connection = OpenILS::Utils::RemoteAccount->new(%$params) or return;
44     return $connection->put;
45 }
46
47 1;
48