line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Copy; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
159167171
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
151
|
|
4
|
4
|
|
|
4
|
|
26
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
327
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$File::Copy::Recursive::CPRFComp = 1; |
7
|
4
|
|
|
4
|
|
21
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
79
|
|
|
4
|
|
|
|
|
45
|
|
8
|
4
|
|
|
4
|
|
4640
|
use Encode; |
|
4
|
|
|
|
|
25892
|
|
|
4
|
|
|
|
|
427
|
|
9
|
4
|
|
|
4
|
|
913
|
use File::Copy::Recursive qw(rcopy); |
|
4
|
|
|
|
|
7102
|
|
|
4
|
|
|
|
|
278
|
|
10
|
4
|
|
|
4
|
|
23
|
use File::Glob; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
203
|
|
11
|
4
|
|
|
4
|
|
25
|
use UNIVERSAL::require; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
39
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub do { |
14
|
0
|
|
|
0
|
0
|
|
my ($params, $logger) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $msg = []; |
17
|
0
|
|
|
|
|
|
my $status = 1; |
18
|
0
|
|
|
|
|
|
foreach my $from (File::Glob::glob($params->{from})) { |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $to = $params->{to}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $from_local = $from; |
23
|
0
|
|
|
|
|
|
my $to_local = $to; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if ($OSNAME eq 'MSWin32') { |
26
|
0
|
|
|
|
|
|
FusionInventory::Agent::Tools::Win32->require; |
27
|
0
|
|
|
|
|
|
my $localCodepage = FusionInventory::Agent::Tools::Win32::getLocalCodepage(); |
28
|
0
|
0
|
|
|
|
|
if (Encode::is_utf8($from)) { |
29
|
0
|
|
|
|
|
|
$from_local = encode($localCodepage, $from); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
0
|
|
|
|
|
if (Encode::is_utf8($to)) { |
32
|
0
|
|
|
|
|
|
$to_local = encode($localCodepage, $to); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if (!File::Copy::Recursive::rcopy($from_local, $to_local)) { |
37
|
0
|
|
|
|
|
|
my $m = "Failed to copy: `".$from."' to '".$to; |
38
|
0
|
|
|
|
|
|
push @$msg, $m; |
39
|
0
|
|
|
|
|
|
push @$msg, $ERRNO; |
40
|
0
|
|
|
|
|
|
$logger->debug($m); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$status = 0; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
return { |
46
|
0
|
|
|
|
|
|
status => $status, |
47
|
|
|
|
|
|
|
msg => $msg, |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |