| 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
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
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
| |||||||||||||||||||||
| 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; | |||||||||||||||||||