@@ -52,30 +52,21 @@ func (openrc OpenRCInitSystem) ServiceRestart(service string) error {
52
52
func (openrc OpenRCInitSystem ) ServiceExists (service string ) bool {
53
53
args := []string {service , "status" }
54
54
outBytes , _ := exec .Command ("rc-service" , args ... ).CombinedOutput ()
55
- if strings .Contains (string (outBytes ), "does not exist" ) {
56
- return false
57
- }
58
- return true
55
+ return ! strings .Contains (string (outBytes ), "does not exist" )
59
56
}
60
57
61
58
// ServiceIsEnabled ensures the service is enabled to start on each boot.
62
59
func (openrc OpenRCInitSystem ) ServiceIsEnabled (service string ) bool {
63
60
args := []string {"show" , "default" }
64
61
outBytes , _ := exec .Command ("rc-update" , args ... ).Output ()
65
- if strings .Contains (string (outBytes ), service ) {
66
- return true
67
- }
68
- return false
62
+ return strings .Contains (string (outBytes ), service )
69
63
}
70
64
71
65
// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
72
66
func (openrc OpenRCInitSystem ) ServiceIsActive (service string ) bool {
73
67
args := []string {service , "status" }
74
68
outBytes , _ := exec .Command ("rc-service" , args ... ).Output ()
75
- if strings .Contains (string (outBytes ), "stopped" ) {
76
- return false
77
- }
78
- return true
69
+ return ! strings .Contains (string (outBytes ), "stopped" )
79
70
}
80
71
81
72
// EnableCommand return a string describing how to enable a service
0 commit comments