line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
33324750
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
96
|
|
4
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
97
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use Cwd; |
|
3
|
|
|
|
|
42
|
|
|
3
|
|
|
|
|
235
|
|
7
|
3
|
|
|
3
|
|
13
|
use English qw(-no_match_vars); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
37
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
2465
|
use FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Move; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
30
|
|
10
|
3
|
|
|
3
|
|
1155
|
use FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Copy; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
30
|
|
11
|
3
|
|
|
3
|
|
1259
|
use FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Mkdir; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
35
|
|
12
|
3
|
|
|
3
|
|
1217
|
use FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Delete; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
30
|
|
13
|
3
|
|
|
3
|
|
1142
|
use FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Cmd; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
30
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
0
|
|
|
0
|
0
|
|
my ($class, %params) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
die "no workdir parameter" unless $params{workdir}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $self = { |
21
|
|
|
|
|
|
|
workdir => $params{workdir} |
22
|
0
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
bless $self, $class; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub process { |
30
|
0
|
|
|
0
|
0
|
|
my ( $self, $actionName, $params, $logger ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $workdir = $self->{workdir}; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
0
|
|
|
|
if ( ( $OSNAME ne 'MSWin32' ) && ( $actionName eq 'messageBox' ) ) { |
35
|
|
|
|
|
|
|
return { |
36
|
0
|
|
|
|
|
|
status => 1, |
37
|
|
|
|
|
|
|
msg => ["not Windows: action `$actionName' ignored"] |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $ret; |
42
|
0
|
|
|
|
|
|
my $cwd = getcwd(); |
43
|
0
|
|
|
|
|
|
chdir( $workdir->{path} ); |
44
|
0
|
0
|
|
|
|
|
if ( $actionName eq 'checks' ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# not an action |
46
|
|
|
|
|
|
|
} elsif ( $actionName eq 'move' ) { |
47
|
0
|
|
|
|
|
|
$ret = |
48
|
|
|
|
|
|
|
FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Move::do( |
49
|
|
|
|
|
|
|
$params, $logger); |
50
|
|
|
|
|
|
|
} elsif ( $actionName eq 'copy' ) { |
51
|
0
|
|
|
|
|
|
$ret = |
52
|
|
|
|
|
|
|
FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Copy::do( |
53
|
|
|
|
|
|
|
$params, $logger); |
54
|
|
|
|
|
|
|
} elsif ( $actionName eq 'mkdir' ) { |
55
|
0
|
|
|
|
|
|
$ret = |
56
|
|
|
|
|
|
|
FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Mkdir::do( |
57
|
|
|
|
|
|
|
$params, $logger); |
58
|
|
|
|
|
|
|
} elsif ( $actionName eq 'delete' ) { |
59
|
0
|
|
|
|
|
|
$ret = |
60
|
|
|
|
|
|
|
FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Delete::do( |
61
|
|
|
|
|
|
|
$params, $logger); |
62
|
|
|
|
|
|
|
} elsif ( $actionName eq 'cmd' ) { |
63
|
0
|
|
|
|
|
|
$ret = |
64
|
|
|
|
|
|
|
FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Cmd::do( |
65
|
|
|
|
|
|
|
$params, $logger); |
66
|
|
|
|
|
|
|
} else { |
67
|
0
|
|
|
|
|
|
$logger->debug("Unknown action type: `$actionName'"); |
68
|
0
|
|
|
|
|
|
chdir($cwd); |
69
|
|
|
|
|
|
|
return { |
70
|
0
|
|
|
|
|
|
status => 0, |
71
|
|
|
|
|
|
|
msg => ["unknown action `$actionName'"] |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
chdir($cwd); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $ret; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |