Modify ↓
Ticket #878 (closed defect: fixed)
Upstart service status with no output produces traceback
Reported by: | Joe Digilio <[email protected]…> | Owned by: | solj |
---|---|---|---|
Priority: | major | Milestone: | Bcfg2 1.1.0 Release |
Component: | bcfg2-client | Version: | 1.0 |
Keywords: | Cc: | [email protected]… |
Description
On Ubuntu 10.04 (with bcfg2-1.1.0-0.1rc1), I get the following traceback for two services (grub-common and bcfg2):
Unexpected failure of verification method for entry type Service Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/Bcfg2/Client/Tools/__init__.py", line 146, in Inventory states[entry] = func(entry, mods) File "/usr/lib/pymodules/python2.6/Bcfg2/Client/Tools/Upstart.py", line 33, in VerifyService entry.get('name'))[1][0] IndexError: list index out of range
Running the following produces no output:
# /usr/sbin/service grub-common status # /usr/sbin/service bcfg2 status #
Attachments
Change History
comment:1 Changed 13 years ago by solj
- Owner changed from desai to solj
- Status changed from new to accepted
comment:2 Changed 13 years ago by solj
- Cc [email protected]… added
This patch should fix your issue:
diff --git a/src/lib/Client/Tools/Upstart.py b/src/lib/Client/Tools/Upstart.py index 1fc80a1..b6e68d5 100644 --- a/src/lib/Client/Tools/Upstart.py +++ b/src/lib/Client/Tools/Upstart.py @@ -29,8 +29,13 @@ class Upstart(Bcfg2.Client.Tools.SvcTool): /etc/init/servicename.conf. All we need to do is make sure the service is running when it should be. ''' - output = self.cmd.run('/usr/sbin/service %s status' % \ - entry.get('name'))[1][0] + try: + output = self.cmd.run('/usr/sbin/service %s status' % \ + entry.get('name'))[1][0] + except IndexError: + self.logger.error("Service %s not an Upstart service" % \ + entry.get('name')) + return False try: running = output.split(' ')[1].split('/')[1].startswith('running') if running:
comment:3 Changed 13 years ago by solj
- Status changed from accepted to closed
- Resolution set to fixed
Added fix in [258025085e8d4a0e4129bf1d2dd36ed7ac8786b2] (SVN r5847).
Note: See
TracTickets for help on using
tickets.
The reason for this is that neither of those services are handled via Upstart. You need to define them with type='deb' in your configuration so that they are handled by DebInit?. I'll work on fixing the traceback.