Modify

Ticket #878 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

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 12 years ago by solj

  • Owner changed from desai to solj
  • Status changed from new to accepted

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.

comment:2 Changed 12 years ago by solj

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 12 years ago by solj

  • Status changed from accepted to closed
  • Resolution set to fixed

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.