Fix traceback in service module when svc_cmd is None (2nd fix)

When service module is used on unsupported Linux system where init
script is used directly, LinuxService.svc_cmd is None so .endswith()
fails.

This extends fix from e2f20db534 also
for state=restarted.

Fixes issue #3533
reviewable/pr18780/r1
Petr Svoboda 11 years ago committed by James Cammarata
parent 2e649d21af
commit f82d3f7fa9

@ -677,7 +677,7 @@ class LinuxService(Service):
else: else:
# SysV # SysV
rc_state, stdout, stderr = self.execute_command("%s %s %s" % (self.action, self.name, arguments), daemonize=True) rc_state, stdout, stderr = self.execute_command("%s %s %s" % (self.action, self.name, arguments), daemonize=True)
elif self.svc_cmd.endswith('rc-service'): elif self.svc_cmd and self.svc_cmd.endswith('rc-service'):
# All services in OpenRC support restart. # All services in OpenRC support restart.
rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True) rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True)
else: else:

Loading…
Cancel
Save