File 0001-Test-cts-service-counts-as-enabled-only-if-it-s-expl.patch of Package pacemaker.14850
ca267fc16 Test: cts: service counts as enabled only if it's explicitly enabled
cts/environment.py | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/cts/environment.py b/cts/environment.py
index 0ce75136f..611d0c3b1 100644
--- a/cts/environment.py
+++ b/cts/environment.py
@@ -180,20 +180,25 @@ class Environment(object):
# default
self["syslogd"] = "rsyslog"
+ def service_is_enabled(self, node, service):
+ if self["have_systemd"]:
+ # Systemd
+
+ # With "systemctl is-enabled", we should check if the service is
+ # explicitly "enabled" instead of the return code. For example it returns
+ # 0 if the service is "static" or "indirect", but they don't really count
+ # as "enabled".
+ return not self.rsh(node, "systemctl is-enabled %s | grep enabled" % service)
+
+ else:
+ # SYS-V
+ return not self.rsh(node, "chkconfig --list | grep -e %s.*on" % service)
+
def detect_at_boot(self):
# Detect if the cluster starts at boot
if not "at-boot" in self.data:
- atboot = 0
-
- if self["have_systemd"]:
- # Systemd
- atboot = atboot or not self.rsh(self.target, "systemctl is-enabled corosync.service")
- atboot = atboot or not self.rsh(self.target, "systemctl is-enabled pacemaker.service")
- else:
- # SYS-V
- atboot = atboot or not self.rsh(self.target, "chkconfig --list | grep -e corosync.*on -e pacemaker.*on")
-
- self["at-boot"] = atboot
+ self["at-boot"] = self.service_is_enabled(self.target, "corosync") \
+ or self.service_is_enabled(self.target, "pacemaker")
def detect_ip_offset(self):
# Try to determine an offset for IPaddr resources
--
2.16.4