| 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
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'}
| |||||||||||||
| 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
| |||||||||||||
| 28 | |||||||||||||
| 29 | 0 | ▶ | return (1, undef) if $self->cfg->{reset_remain} == 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||