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