File Coverage

blib/lib/Armadito/Agent/Antivirus/Armadito/Task/State.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 13 25 52.0


line stmt bran cond sub pod time code
1             package Armadito::Agent::Antivirus::Armadito::Task::State;
2              
3 1     1   15958632 use strict;
  1         5  
  1         48  
4 1     1   11 use warnings;
  1         1  
  1         61  
5 1     1   9 use base 'Armadito::Agent::Task::State';
  1         31  
  1         420  
6              
7             sub run {
8 0     0 1   my ( $self, %params ) = @_;
9              
10 0           $self = $self->SUPER::run(%params);
11 0           $self->{av_client} = Armadito::Agent::HTTP::Client::ArmaditoAV->new( taskobj => $self );
12 0           $self->{av_client}->register();
13              
14             my $response = $self->{av_client}->sendRequest(
15 0           "url" => $self->{av_client}->{server_url} . "/api/status",
16             method => "GET"
17             );
18              
19 0 0         die "Unable to get AV status with ArmaditoAV api."
20             if ( !$response->is_success() );
21              
22 0           $self->{av_client}->pollEvents();
23 0           $self->{av_client}->unregister();
24              
25 0           return $self;
26             }
27              
28             1;
29              
30             __END__
31              
32             =head1 NAME
33              
34             Armadito::Agent::Antivirus::Armadito::Task::State - State Task for Armadito Antivirus.
35              
36             =head1 DESCRIPTION
37              
38             This task inherits from L<Armadito::Agent::Task:State>. Ask for Armadito Antivirus state using AV's API REST protocol and then send it in a json formatted POST request to Armadito plugin for GLPI.
39              
40             =head1 FUNCTIONS
41              
42             =head2 run ( $self, %params )
43              
44             Run the task.
45              
46             =head2 new ( $self, %params )
47              
48             Instanciate Task.
49