Merge branch 'ent-7325-fallo-en-el-borrado-de-los-data-de-tmp-para-tareas-vmware' into 'develop'

Allow sending file_path with symbols

See merge request artica/pandorafms!4043
This commit is contained in:
vgilc 2021-04-20 13:09:50 +00:00
commit 6e087397fe
1 changed files with 5 additions and 3 deletions

View File

@ -805,7 +805,9 @@ sub transfer_xml {
if (empty($file_name)){ if (empty($file_name)){
$file_name = trim(`hostname`); $file_name = trim(`hostname`);
} }
# Tentacle server does not allow files with symbols in theirs name.
$file_name =~ s/[^a-zA-Z0-9_-]//g;
$file_name .= "." . sprintf("%d",time()) . ".data"; $file_name .= "." . sprintf("%d",time()) . ".data";
} }
@ -867,11 +869,11 @@ sub transfer_xml {
my $r = -1; my $r = -1;
#Send using tentacle #Send using tentacle
if ($^O =~ /win/i) { if ($^O =~ /win/i) {
$msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path"`; $msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} '$file_path'`;
$r = $?; $r = $?;
} }
else { else {
$msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} "$file_path" 2>&1`; $msg = `$conf->{tentacle_client} -v -a $conf->{tentacle_ip} -p $conf->{tentacle_port} $conf->{tentacle_opts} '$file_path' 2>&1`;
$r = $?; $r = $?;
} }