line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Mkdir; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
133384237
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
189
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
167
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
14
|
use File::Path; |
|
4
|
|
|
|
|
36
|
|
|
4
|
|
|
|
|
343
|
|
7
|
4
|
|
|
4
|
|
680
|
use Encode; |
|
4
|
|
|
|
|
8244
|
|
|
4
|
|
|
|
|
266
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
28
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
41
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
1675
|
use UNIVERSAL::require; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
36
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub do { |
14
|
0
|
|
|
0
|
0
|
|
my ($params, $logger) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $msg = []; |
18
|
0
|
|
|
|
|
|
my $status = 1; |
19
|
0
|
|
|
|
|
|
foreach my $dir (@{$params->{list}}) { |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $dir_local = $dir; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
0
|
|
|
|
if ($OSNAME eq 'MSWin32' && Encode::is_utf8($dir)) { |
24
|
0
|
|
|
|
|
|
FusionInventory::Agent::Tools::Win32->require; |
25
|
0
|
|
|
|
|
|
my $localCodepage = FusionInventory::Agent::Tools::Win32::getLocalCodepage(); |
26
|
0
|
|
|
|
|
|
$dir_local = encode($localCodepage, $dir); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if (-d $dir_local) { |
30
|
0
|
|
|
|
|
|
my $m = "Directory $dir already exists"; |
31
|
0
|
|
|
|
|
|
push @$msg, $m; |
32
|
0
|
|
|
|
|
|
$logger->debug($m); |
33
|
|
|
|
|
|
|
} else { |
34
|
0
|
|
|
|
|
|
File::Path::mkpath($dir_local); |
35
|
0
|
0
|
|
|
|
|
if (!-d $dir_local) { |
36
|
0
|
|
|
|
|
|
$status = 0; |
37
|
0
|
|
|
|
|
|
my $m = "Failed to create $dir directory"; |
38
|
0
|
|
|
|
|
|
push @$msg, $m; |
39
|
0
|
|
|
|
|
|
$logger->debug($m); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
return { |
44
|
0
|
|
|
|
|
|
status => $status, |
45
|
|
|
|
|
|
|
msg => $msg, |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |