psvo/ansible — pull request #1 by psvo (2013-09-13 14:37:02+00:00)
Title: 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 e2f20db53481128553d876109d5fbdab9f43dd5b also for state=restarted.

Fixes issue #3533

Running against Debian Lenny server:
```
$ ansible webserver.local -i webserver.local, -u root -m service -a 'name=apache2 state=restarted'
webserver.local | FAILED => failed to parse: Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-1379082596.06-63995244988034/service", line 2080, in
main()
File "/root/.ansible/tmp/ansible-1379082596.06-63995244988034/service", line 1112, in main
(rc, out, err) = service.modify_service_state()
File "/root/.ansible/tmp/ansible-1379082596.06-63995244988034/service", line 299, in modify_service_state
return self.service_control()
File "/root/.ansible/tmp/ansible-1379082596.06-63995244988034/service", line 670, in service_control
elif self.svc_cmd.endswith('rc-service'):
AttributeError: 'NoneType' object has no attribute 'endswith'
```