MCP/State/Plugin/OSRC.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 62.5% 5 / 8 Podpod 50.0% 1 / 2 totaltotal 48.0% 25 / 52 CC 5 SCAR 21.1
CC
5
Cov
46%
keep_alive
20.0
BUILD
6.0
__ANON__
2.0
CRAP 8.2
« MCP/Scheduler/Controller.pm ↑ Summary MCP/Scheduler/Job.pm »
1 package Tapper::MCP::State::Plugin::OSRC;
2 1 our $AUTHORITY = 'cpan:TAPPER';
3 1 $Tapper::MCP::State::Plugin::OSRC::VERSION = '5.0.9';
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Tapper::MCP::Net::Reset::OSRC;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Tapper::MCP::Net;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 has cfg => (is => 'rw',
11 isa => 'HashRef',
12 0 ▶ default => sub {{}},
Subroutine __ANON__: not called CC=1 SCAR=6.9
13 1 );
14  
15  
16 0 ▶sub BUILD{
Subroutine BUILD: not called CC=2 SCAR=17.9
Pod undocumented
17 0 my ($self) = @_;
18 0 ▶ $self->cfg->{reset_remain} = $self->cfg->{mcp_callback_handler}{pluginoptions}{try_reset} || 0;
Condition0%0/2
$self->cfg->{'mcp_callback_handler'}{'pluginoptions'}{'try_reset'} || 0
l!l
00
MC/DC0%0/1
$self->cfg->{'mcp_callback_handler'}{'pluginoptions'}{'try_reset'} || 0
$self->cfg->{'mcp_callback_handler'}{'pluginoptions'}{'try_reset'}
Truth table0%0/2
A
A= $self->cfg->{'mcp_callback_handler'}{'pluginoptions'}{'try_reset'}
Aresult
11
00
19 }
20  
21  
22 sub keep_alive
23 0 ▶{
Subroutine keep_alive: not called CC=4 SCAR=30.0
Pod documented
24 0 my ($self, $state_details) = @_;
25  
26 # try resetting only in reboot states
27 0 ▶ return (1, undef) if $state_details->current_state !~ m/reboot/;
Branch: 1 branch
BranchTrueFalseTotal
unless $state_details->current_state =~ /reboot/ 0 0 0
28  
29 0 ▶ return (1, undef) if $self->cfg->{reset_remain} == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->cfg->{"reset_remain"} == 0 0 0 0
30  
31  
32 0 my $resetter = Tapper::MCP::Net::Reset::OSRC->new();
33 0 my $options;
34 0 ▶ if ($self->cfg->{reset_plugin} eq 'OSRC') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cfg->{'reset_plugin'} eq 'OSRC') { } 0 0 0
35 $options = $self->cfg->{reset_plugin_options}
36 0 } else {
37 0 $options = $self->cfg->{mcp_callback_handler}{options}{reset_options};
38 }
39 0 $resetter->reset_host($self->cfg->{hostname}, $options);
40 0 $self->cfg->{reset_remain}--;
41 0 return (0, $self->cfg->{keep_alive}{timeout_receive});
42 }
43  
44 1 1;
45  
46 __END__
« MCP/Scheduler/Controller.pm ↑ Summary MCP/Scheduler/Job.pm »