line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::Task; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
652661
|
use strict; |
|
21
|
|
|
|
|
26
|
|
|
21
|
|
|
|
|
579
|
|
4
|
21
|
|
|
21
|
|
87
|
use warnings; |
|
21
|
|
|
|
|
35
|
|
|
21
|
|
|
|
|
555
|
|
5
|
21
|
|
|
21
|
|
7319
|
use Armadito::Agent; |
|
21
|
|
|
|
|
43
|
|
|
21
|
|
|
|
|
220
|
|
6
|
21
|
|
|
21
|
|
9161
|
use Armadito::Agent::HTTP::Client::ArmaditoGLPI; |
|
21
|
|
|
|
|
57
|
|
|
21
|
|
|
|
|
290
|
|
7
|
21
|
|
|
21
|
|
9144
|
use Armadito::Agent::Tools::Inventory qw(getUUID); |
|
21
|
|
|
|
|
55
|
|
|
21
|
|
|
|
|
5525
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
10
|
0
|
|
|
0
|
1
|
|
my ( $self, %params ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
if ( $self->{use_glpiclient} ) { |
13
|
0
|
|
|
|
|
|
$self->initGLPIClient(); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub initGLPIClient { |
20
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$self->{glpi_client} = Armadito::Agent::HTTP::Client::ArmaditoGLPI->new( |
23
|
|
|
|
|
|
|
logger => $self->{logger}, |
24
|
|
|
|
|
|
|
user => $self->{agent}->{config}->{user}, |
25
|
|
|
|
|
|
|
password => $self->{agent}->{config}->{password}, |
26
|
|
|
|
|
|
|
proxy => $self->{agent}->{config}->{proxy}, |
27
|
|
|
|
|
|
|
ca_cert_file => $self->{agent}->{config}->{ca_cert_file}, |
28
|
|
|
|
|
|
|
ca_cert_dir => $self->{agent}->{config}->{ca_cert_dir}, |
29
|
|
|
|
|
|
|
no_ssl_check => $self->{agent}->{config}->{no_ssl_check}, |
30
|
|
|
|
|
|
|
debug => $self->{agent}->{config}->{debug} |
31
|
0
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
die "Error when creating ArmaditoGLPI client!" unless $self->{glpi_client}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
0
|
|
|
0
|
1
|
|
my ( $class, %params ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
my $use_glpiclient = defined( $params{use_glpiclient} ) ? $params{use_glpiclient} : 1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $self = { |
42
|
|
|
|
|
|
|
logger => $params{agent}->{logger}, |
43
|
|
|
|
|
|
|
agent => $params{agent}, |
44
|
0
|
|
|
|
|
|
use_glpiclient => $use_glpiclient |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$self->{jobj} = { |
48
|
|
|
|
|
|
|
agent_id => $self->{agent}->{agent_id}, |
49
|
0
|
|
|
|
|
|
agent_version => $Armadito::Agent::VERSION, |
50
|
|
|
|
|
|
|
uuid => getUUID(), |
51
|
|
|
|
|
|
|
task => "" |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
bless $self, $class; |
55
|
0
|
|
|
|
|
|
return $self; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Armadito::Agent::Task - Armadito Agent Task base class. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This is a base class for each Tasks used to interact with Armadito Antivirus and Armadito plugin for GLPI. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 FUNCTIONS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 run ( $self, %params ) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Run the task. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 new ( $self, %params ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Instanciate Armadito module. Set task's default logger. |
79
|
|
|
|
|
|
|
|