line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Copy; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
130185421
|
use strict; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
122
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
211
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$File::Copy::Recursive::CPRFComp = 1; |
7
|
4
|
|
|
4
|
|
26
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
52
|
|
|
4
|
|
|
|
|
33
|
|
8
|
4
|
|
|
4
|
|
2819
|
use Encode; |
|
4
|
|
|
|
|
17447
|
|
|
4
|
|
|
|
|
375
|
|
9
|
4
|
|
|
4
|
|
18
|
use File::Copy::Recursive qw(rcopy); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
338
|
|
10
|
4
|
|
|
4
|
|
67
|
use File::Glob; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
167
|
|
11
|
4
|
|
|
4
|
|
15
|
use UNIVERSAL::require; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
37
|
|
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; |