System/Centos/Service.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« System/Centos/Package.pm ↑ Summary System/Centos/User.pm »
1 #
2 # $Id$
3 #
4 # system::centos::service Brik
5 #
6 package Metabrik::System::Centos::Service;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik::Shell::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 attributes => {
19 },
20 attributes_default => {
21 },
22 commands => {
23 enable => [ qw(service_name) ],
24 disable => [ qw(service_name) ],
25 },
26 require_binaries => {
27 systemctl => [ ],
28 },
29 need_packages => {
30 centos => [ qw(systemd) ],
31 },
32 };
33 }
34  
35 sub enable {
36 my $self = shift;
37 my ($service_name) = @_;
38  
39 $self->brik_help_run_undef_arg('enable', $service_name) or return;
40  
41 my $cmd = "systemctl enable \"$service_name\"";
42  
43 return $self->sudo_execute($cmd);
44 }
45  
46 sub disable {
47 my $self = shift;
48 my ($service_name) = @_;
49  
50 $self->brik_help_run_undef_arg('disable', $service_name) or return;
51  
52 my $cmd = "systemctl disable \"$service_name\"";
53  
54 return $self->sudo_execute($cmd);
55 }
56  
57 1;
58  
59 __END__
« System/Centos/Package.pm ↑ Summary System/Centos/User.pm »