Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module 'service' error on Debian Lenny with svc_cmd #3533

Closed
psvo opened this issue Jul 15, 2013 · 6 comments
Closed

Module 'service' error on Debian Lenny with svc_cmd #3533

psvo opened this issue Jul 15, 2013 · 6 comments

Comments

@psvo
Copy link
Contributor

psvo commented Jul 15, 2013

Module service dies with exception - see below. Problem is caused probably by commit bcca609 which references
'svc_cmd' object attribute that can be None.

Error is triggered at least on Debian Lenny but probably other distributions could be affected too. Debian Squeeze works OK.

Traceback (most recent call last):
  File "service", line 2031, in <module>
    main()
  File "service", line 1075, in main
    service.get_service_status()
  File "service", line 450, in get_service_status
    rc, status_stdout, status_stderr = self.service_control()
  File "service", line 629, in service_control
    if self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed:
AttributeError: 'NoneType' object has no attribute 'endswith'

Same problem also on another places:

 Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-1373895034.66-231531890981472/service", line 2031, in <module>
    main()
  File "/root/.ansible/tmp/ansible-1373895034.66-231531890981472/service", line 1075, in main
    service.get_service_status()
  File "/root/.ansible/tmp/ansible-1373895034.66-231531890981472/service", line 461, in get_service_status
    if self.svc_cmd.endswith("rc-service") and self.running is None:
AttributeError: 'NoneType' object has no attribute 'endswith'
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-1373895217.93-217326251263220/service", line 2031, in <module>
    main()
  File "/root/.ansible/tmp/ansible-1373895217.93-217326251263220/service", line 1081, in main
    (rc, out, err) = service.modify_service_state()
  File "/root/.ansible/tmp/ansible-1373895217.93-217326251263220/service", line 299, in modify_service_state
    return self.service_control()
  File "/root/.ansible/tmp/ansible-1373895217.93-217326251263220/service", line 639, in service_control
    elif self.svc_cmd.endswith('rc-service'):
AttributeError: 'NoneType' object has no attribute 'endswith'
@mpdehaan
Copy link
Contributor

First I've heard of this one so I'm a little unsure whether this is across
the board, or perhaps not many people are running Lenny?

Will take a look, thanks.

On Mon, Jul 15, 2013 at 9:21 AM, psvo notifications@github.com wrote:

Module service dies with exception - see below. Problem is caused probably
by commit bcca609bcca609bc6693aec600e17db26c7c77f32ceb8d7which references
'svc_cmd' object attribute that can be None.

Error is triggered at least on Debian Lenny but probably other
distributions could be affected too. Debian Squeeze works OK.

Traceback (most recent call last):
File "service", line 2031, in
main()
File "service", line 1075, in main
service.get_service_status()
File "service", line 450, in get_service_status
rc, status_stdout, status_stderr = self.service_control()
File "service", line 629, in service_control
if self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed:
AttributeError: 'NoneType' object has no attribute 'endswith'


Reply to this email directly or view it on GitHubhttps://github.com//issues/3533
.

@mpdehaan
Copy link
Contributor

Can you share the line from your ansible playbook you were using?

@psvo
Copy link
Contributor Author

psvo commented Jul 15, 2013

Can you share the line from your ansible playbook you were using?

Following is enough to trigger this error (but happens with ansible-playbook too):

# cat hosts
webserver

# ansible webserver -u root -i hosts -m service -a 'name=apache2 state=started'

@mpdehaan
Copy link
Contributor

Interesting.

Haven't heard this reported before and am quite surprised why that would be.

On Mon, Jul 15, 2013 at 10:15 AM, psvo notifications@github.com wrote:

Can you share the line from your ansible playbook you were using?

Following is enough to trigger this error (but happens with
ansible-playbook too):

cat hosts

webserver

ansible webserver -u root -i hosts -m service -a 'name=apache2 state=started'


Reply to this email directly or view it on GitHubhttps://github.com//issues/3533#issuecomment-20972116
.

@psvo
Copy link
Contributor Author

psvo commented Jul 15, 2013

I looked at it in more detail...

Actual status on Lenny is:

self.svc_cmd is None
self.svc_initscript is /etc/init.d/apache2

And on Squeeze:

self.svc_cmd is /usr/sbin/service
self.svc_initscript is None

And that seems correct, because on Lenny none of searched binaries exists (except for update-rc.d, but that is irrelevant here). In Lenny "service" binary is installed by "admin/sysvconfig" or "admin/chkconfig" but none of them is installed on our systems.

AFAIK native binary used by Debian systems is (or at least was) "invoke-rc.d", but it is not detected at all.

@jcbagneris
Copy link
Contributor

I can confirm the problem, it happened to me recently on a Lenny host. Younger debians (squeeze etc.) are not affected

mpdehaan pushed a commit that referenced this issue Aug 10, 2013
When service module is used on unsupported Linux system where init
script is used directly, LinuxService.svc_cmd is None so .endswith()
fails.

Fixes issue #3533
psvo added a commit to psvo/ansible that referenced this issue Sep 13, 2013
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 e2f20db also
for state=restarted.

Fixes issue ansible#3533
jimi-c pushed a commit that referenced this issue Sep 19, 2013
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 e2f20db also
for state=restarted.

Fixes issue #3533
@psvo psvo closed this as completed Sep 27, 2013
carsongee pushed a commit to carsongee/ansible that referenced this issue Nov 5, 2013
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 e2f20db also
for state=restarted.

Fixes issue ansible#3533
@ansible ansible locked and limited conversation to collaborators Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants