1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Petr Svoboda 2013-09-13 16:26:11 +02:00 committed by James Cammarata
parent d89f104e91
commit 8d290e3394

View file

@ -677,7 +677,7 @@ class LinuxService(Service):
else:
# SysV
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.
rc_state, stdout, stderr = self.execute_command("%s %s %s" % (svc_cmd, self.action, arguments), daemonize=True)
else: