2008-03-14 Ramon Novoa <rnovoa@artica.es>

* win32/pandora_windows_service.cc: Added support for Tentacle file transfers.
	* win32/pandora_windows_service.h: Added support for Tentacle file transfers.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@750 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2008-03-14 13:41:31 +00:00
parent 6b0cc12795
commit daaca58b6a
3 changed files with 77 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-03-14 Ramon Novoa <rnovoa@artica.es>
* win32/pandora_windows_service.cc: Added support for Tentacle file transfers.
* win32/pandora_windows_service.h: Added support for Tentacle file transfers.
2008-03-11 Ramon Novoa <rnovoa@artica.es>
* linux/pandora_agent: Added support for Tentacle file transfers.

View File

@ -160,6 +160,74 @@ Pandora_Windows_Service::getXmlHeader () {
return agent;
}
void
Pandora_Windows_Service::copyTentacleDataFile (string host,
string filename)
{
int rc;
string var, filepath;
string pubkey_file, privkey_file;
string tentacle_cmd;
var = conf->getValue ("temporal");
if (var[var.length () - 1] != '\\') {
var += "\\";
}
filepath = var + filename;
/* Build the command to launch the Tentacle client */
tentacle_cmd = "tentacle_client.exe -a " + host;
var = conf->getValue ("server_port");
if (var != "") {
tentacle_cmd += " -p " + var;
}
var = conf->getValue ("server_ssl");
if (var == "1") {
tentacle_cmd += " -c";
}
var = conf->getValue ("server_pwd");
if (var != "") {
tentacle_cmd += " -x " + var;
}
var = conf->getValue ("server_opts");
if (var != "") {
tentacle_cmd += " " + var;
}
tentacle_cmd += " " + filepath;
/* Copy the file */
pandoraDebug ("Remote copying XML %s on server %s",
filepath.c_str (), host.c_str ());
pandoraDebug ("Command %s", tentacle_cmd.c_str());
rc = system (tentacle_cmd.c_str());
switch (rc) {
/* system() error */
case -1:
pandoraLog ("Unable to copy %s", filename.c_str ());
throw Pandora_Exception ();
/* tentacle_client.exe returned OK */
case 0:
break;
/* tentacle_client.exe error */
default:
pandoraLog ("Tentacle client was unable to copy %s",
filename.c_str ());
throw Pandora_Exception ();
}
return;
}
void
Pandora_Windows_Service::copyScpDataFile (string host,
string remote_path,
@ -274,6 +342,8 @@ Pandora_Windows_Service::copyDataFile (string filename)
try {
if (mode == "ftp") {
copyFtpDataFile (host, remote_path, filename);
} else if (mode == "tentacle") {
copyTentacleDataFile (host, filename);
} else if (mode == "ssh" || mode == "") {
copyScpDataFile (host, remote_path, filename);
} else {

View File

@ -43,6 +43,8 @@ namespace Pandora {
TiXmlElement *getXmlHeader ();
void copyDataFile (string filename);
void copyTentacleDataFile (string host,
string filename);
void copyScpDataFile (string host,
string remote_path,
string filename);