line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Copy; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
127255932
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
151
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
213
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$File::Copy::Recursive::CPRFComp = 1; |
7
|
3
|
|
|
3
|
|
19
|
use English qw(-no_match_vars); |
|
3
|
|
|
|
|
43
|
|
|
3
|
|
|
|
|
30
|
|
8
|
3
|
|
|
3
|
|
2882
|
use Encode; |
|
3
|
|
|
|
|
21741
|
|
|
3
|
|
|
|
|
255
|
|
9
|
3
|
|
|
3
|
|
505
|
use File::Copy::Recursive qw(rcopy); |
|
3
|
|
|
|
|
5172
|
|
|
3
|
|
|
|
|
178
|
|
10
|
3
|
|
|
3
|
|
15
|
use File::Glob; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
139
|
|
11
|
3
|
|
|
3
|
|
14
|
use UNIVERSAL::require; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
25
|
|
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; |