-
Notifications
You must be signed in to change notification settings - Fork 1
/
openrc-0.10.7.patch
118 lines (109 loc) · 4.18 KB
/
openrc-0.10.7.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--- a/pcs/lib/external.py
+++ b/pcs/lib/external.py
@@ -192,7 +192,7 @@ def disable_service(runner, service, instance=None):
[_systemctl, "disable", _get_service_name(service, instance)]
)
else:
- stdout, stderr, retval = runner.run([_chkconfig, service, "off"])
+ stdout, stderr, retval = runner.run([_chkconfig, 'delete', service, "default"])
if retval != 0:
raise DisableServiceError(
service, join_multilines([stderr, stdout]), instance
@@ -214,7 +214,7 @@ def enable_service(runner, service, instance=None):
[_systemctl, "enable", _get_service_name(service, instance)]
)
else:
- stdout, stderr, retval = runner.run([_chkconfig, service, "on"])
+ stdout, stderr, retval = runner.run([_chkconfig, 'add', service, "default"])
if retval != 0:
raise EnableServiceError(
service, join_multilines([stderr, stdout]), instance
@@ -295,7 +295,12 @@ def is_service_enabled(
[_systemctl, "is-enabled", _get_service_name(service, instance)]
)
else:
- dummy_stdout, dummy_stderr, retval = runner.run([_chkconfig, service])
+ stdout, dummy_stderr, dummy_retval = runner.run([_chkconfig, 'list', 'default'])
+ retval = 1
+ for line in stdout.splitlines():
+ line = line.strip()
+ if service == line:
+ retval = 0
return retval == 0
@@ -345,13 +350,13 @@ def get_non_systemd_services(runner):
if is_systemctl():
return []
- stdout, dummy_stderr, return_code = runner.run([_chkconfig])
+ stdout, dummy_stderr, return_code = runner.run([_chkconfig, "list"])
if return_code != 0:
return []
service_list = []
for service in stdout.splitlines():
- service = service.split(" ", 1)[0]
+ service = service.strip().split(' ')[0]
if service:
service_list.append(service)
return service_list
--- a/pcs/settings_default.py
+++ b/pcs/settings_default.py
@@ -1,8 +1,8 @@
import os.path
systemctl_binary = "/bin/systemctl"
-chkconfig_binary = "/sbin/chkconfig"
-service_binary = "/sbin/service"
+chkconfig_binary = "/usr/bin/rc-config"
+service_binary = "/sbin/rc-service"
pacemaker_binaries = "/usr/sbin/"
crm_resource_binary = os.path.join(pacemaker_binaries, "crm_resource")
corosync_binaries = "/usr/sbin/"
--- a/pcsd/pcs.rb
+++ b/pcsd/pcs.rb
@@ -1709,7 +1709,7 @@ def is_service_enabled?(service)
if ISSYSTEMCTL
cmd = ['systemctl', 'is-enabled', "#{service}.service"]
else
- cmd = ['chkconfig', service]
+ cmd = ['rc-config','list default|grep -q', service]
end
_, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd)
return (retcode == 0)
@@ -1722,7 +1722,7 @@ def is_service_running?(service)
# encoding/decoding errors. We are not interested in the lines anyway.
cmd = ['systemctl', 'status', '--lines=0', "#{service}.service"]
else
- cmd = ['service', service, 'status']
+ cmd = ['rc-status', 'default|grep started| grep -q', service]
end
_, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd)
return (retcode == 0)
@@ -1775,11 +1775,12 @@ end
class ServiceInstalledCheckerChkconfig < ServiceInstalledChecker
protected
def run_command
- return run_cmd(PCSAuth.getSuperuserAuth(), 'chkconfig')
+ cmd = ['rc-config', 'list']
+ return run_cmd(PCSAuth.getSuperuserAuth(), *cmd)
end
def contains_line_service?(line, service)
- return line.split(' ')[0] == service
+ return line.strip == service
end
end
@@ -1802,7 +1803,7 @@ def enable_service(service)
cmd = ['systemctl', 'enable', "#{service}.service"]
else
# fails when the service is not installed
- cmd = ['chkconfig', service, 'on']
+ cmd = ['rc-config', 'add', service, 'default']
end
_, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd)
return (retcode == 0)
@@ -1817,7 +1818,7 @@ def disable_service(service)
if ISSYSTEMCTL
cmd = ['systemctl', 'disable', "#{service}.service"]
else
- cmd = ['chkconfig', service, 'off']
+ cmd = ['rc-config', 'delete', service, 'default']
end
_, _, retcode = run_cmd(PCSAuth.getSuperuserAuth(), *cmd)
return (retcode == 0)