2008-12-24 Ramon Novoa <rnovoa@artica.es>
* win32/pandora_windows_service.h, win32/bin/pandora_agent.conf, win32/pandora_windows_service.cc: Added local transfer mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1309 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8864dc4095
commit
555246536d
|
@ -1,3 +1,9 @@
|
|||
2008-12-24 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* win32/pandora_windows_service.h,
|
||||
win32/bin/pandora_agent.conf,
|
||||
win32/pandora_windows_service.cc: Added local transfer mode.
|
||||
|
||||
2008-12-24 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* win32/pandora_windows_service.cc: Do not send XML if server address
|
||||
|
|
|
@ -28,7 +28,7 @@ temporal "$AgentTemp$"
|
|||
|
||||
interval 300
|
||||
|
||||
# tranfer_modes: Possible values are tentacle (default), ftp and ssh.
|
||||
# tranfer_modes: Possible values are local, tentacle (default), ftp and ssh.
|
||||
transfer_mode tentacle
|
||||
server_port 41121
|
||||
|
||||
|
|
|
@ -372,19 +372,24 @@ Pandora_Windows_Service::copyDataFile (string filename)
|
|||
mode = conf->getValue ("transfer_mode");
|
||||
host = conf->getValue ("server_ip");
|
||||
remote_path = conf->getValue ("server_path");
|
||||
if (remote_path[remote_path.length () - 1] != '/') {
|
||||
// Fix remote path
|
||||
if (mode != "local" && remote_path[remote_path.length () - 1] != '/') {
|
||||
remote_path += "/";
|
||||
} else if (mode == "local" && remote_path[remote_path.length () - 1] != '\\') {
|
||||
remote_path += "\\";
|
||||
}
|
||||
|
||||
try {
|
||||
if (mode == "ftp") {
|
||||
copyFtpDataFile (host, remote_path, filename, conf->getValue ("server_pwd"));
|
||||
} else if (mode == "tentacle") {
|
||||
} else if (mode == "tentacle" || mode == "") {
|
||||
copyTentacleDataFile (host, filename, conf->getValue ("server_port"),
|
||||
conf->getValue ("server_ssl"), conf->getValue ("server_pwd"),
|
||||
conf->getValue ("server_opts"));
|
||||
} else if (mode == "ssh" || mode == "") {
|
||||
} else if (mode == "ssh") {
|
||||
copyScpDataFile (host, remote_path, filename);
|
||||
} else if (mode == "local") {
|
||||
copyLocalDataFile (remote_path, filename);
|
||||
} else {
|
||||
pandoraLog ("Invalid transfer mode: %s."
|
||||
"Please recheck transfer_mode option "
|
||||
|
@ -518,6 +523,23 @@ Pandora_Windows_Service::recvDataFile (string filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Pandora_Windows_Service::copyLocalDataFile (string remote_path,
|
||||
string filename)
|
||||
{
|
||||
string local_path, local_file, remote_file;
|
||||
local_path = conf->getValue ("temporal");
|
||||
if (local_path[local_path.length () - 1] != '\\') {
|
||||
local_path += "\\";
|
||||
}
|
||||
|
||||
local_file = local_path + filename;
|
||||
remote_file = remote_path + filename;
|
||||
if (!CopyFile (local_file.c_str (), remote_file.c_str (), TRUE)) {
|
||||
throw Pandora_Exception ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Pandora_Windows_Service::checkConfig () {
|
||||
int i, conf_size;
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace Pandora {
|
|||
string remote_path,
|
||||
string filename,
|
||||
string password);
|
||||
void copyLocalDataFile (string remote_path,
|
||||
string filename);
|
||||
void recvDataFile (string filename);
|
||||
void recvTentacleDataFile (string host,
|
||||
string filename);
|
||||
|
|
Loading…
Reference in New Issue