lib/Rex/Service/SunOS.pm

filter: Statementstmt 52.7% 19 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 41.6% 25 / 60 CC 5 SCAR 21.0
CC
5
Cov
41%
ensure
20.0
new
6.0
BEGIN
1.0
CRAP 8.2
« lib/Rex/Pkg/VoidLinux.pm ↑ Summary lib/Rex/Pkg/ALT.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Service::SunOS;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex::Helper::Run;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Rex::Commands::Fs;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use base qw(Rex::Service::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $that = shift;
20 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
21 0 my $self = $proto->SUPER::new(@_);
22  
23 0 bless( $self, $proto );
24  
25 $self->{commands} = {
26 0 start => '/etc/init.d/%s start',
27 restart => '/etc/init.d/%s restart',
28 stop => '/etc/init.d/%s stop',
29 reload => '/etc/init.d/%s reload',
30 status => '/etc/init.d/%s status',
31 action => '/etc/init.d/%s %s',
32 };
33  
34 0 return $self;
35 }
36  
37 0 ▶sub ensure {
Subroutine ensure: not called CC=4 SCAR=30.0
Pod undocumented
38 0 my ( $self, $service, $options ) = @_;
39  
40 0 my $what = $options->{ensure};
41  
42 0 ▶ if ( $what =~ /^stop/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($what =~ /^stop/u) { } 0 0 0
elsif ($what =~ /^start/u or $what =~ /^run/u) { } 0 0 0
43 0 $self->stop( $service, $options );
44 0 eval { i_run "rm /etc/rc*.d/S*$service"; };
45 }
46 ▶ elsif ( $what =~ /^start/ || $what =~ m/^run/ ) {
Condition0%0/3
$what =~ /^start/u or $what =~ /^run/u
l!l&&r!l&&!r
000
MC/DC0%0/2
$what =~ /^start/u or $what =~ /^run/u
$what =~ /^start/u $what =~ /^run/u
Truth table0%0/3
A or B
A= $what =~ /^start/uB= $what =~ /^run/u
ABresult
1X1
011
000
47 0 $self->start( $service, $options );
48 0 my ($runlevel) = map { /run-level (\d)/ } i_run "who -r";
49 0 ln "/etc/init.d/$service", "/etc/rc${runlevel}.d/S99$service";
50 }
51  
52 0 return 1;
53 }
54  
55 1 1;
« lib/Rex/Pkg/VoidLinux.pm ↑ Summary lib/Rex/Pkg/ALT.pm »