asterisk init script is not LSB compliant (for heartbeat, i.e. linux-ha)

Bug #248947 reported by Florian Hackenberger
8
Affects Status Importance Assigned to Milestone
asterisk (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: asterisk

Description: Ubuntu 8.04
Release: 8.04
Package: asterisk
Version: 1:1.4.17~dfsg-2ubuntu1

In order to use asterisk in a heartbeat setup, I need the init script to report the status of the service according to the LSB standard [1]. The script has to exit with a status of 3 if the service is stopped and 0 if it is running. But the asterisk init script returns 1 if asterisk is stopped and 0 if it is running. The fix is quite easy:

--- /etc/init.d/asterisk.orig 2008-04-12 07:03:24.000000000 +0000
+++ /etc/init.d/asterisk 2008-07-16 09:05:27.000000000 +0000
@@ -126,7 +126,7 @@
        plist=`ps ax | awk "{ if (\\$5 == \"$DAEMON\") print \\$1 }"`
        if [ "$plist" = "" ]; then
                echo "$DESC is stopped"
- return 1
+ return 3
        else
                echo "$DESC is running: $plist"
                return 0

[1] http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Related branches

Revision history for this message
Onno Benschop (onno-itmaze) wrote :

I think that it would not be a good idea to continue to use awk to detect if the daemon is running. It would in my opinion make more sense to make this code use the status_of_proc() function which is now included in the init functions.

Revision history for this message
Onno Benschop (onno-itmaze) wrote :

I just noticed that you're also suggesting to change the return value from 1 to 3, and while this may be correct from an LSB perspective, I strongly suspect that there are other applications that rely on the return value being 1.

It would be prudent to identify is there is any code that is shipped with Ubuntu that relies on the asterisk return value before actually changing this return value.

Revision history for this message
Onno Benschop (onno-itmaze) wrote :

See https://wiki.ubuntu.com/InitScriptStatusActions for suggestions on how to implement this.

Revision history for this message
Thierry Carrez (ttx) wrote :

Proposed debdiff

All code inside the init script tests if status returns 0 or non-zero so it is not affected.
If there is anything that relies on asterisk returning the wrong code, then it must be fixed...

asterisk (1:1.4.21.2~dfsg-1ubuntu3) intrepid; urgency=low

  * debian/asterisk.init: Fix status action so that it returns the
    LSB-compliant return codes (LP: #248947)
  * debian/control: added lsb-base dependency for using status_of_proc

 -- Thierry Carrez <thierry.carrez@xxx> Mon, 29 Sep 2008 14:21:59 +0200

Changed in asterisk:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Feature Freeze Exception requested for Thierry's attached patch.

The change is an improvement of the asterisk init script status action, which currently is a pretty crufty "ps | awk", and instead uses the LSB's status_of_proc() function.

This fix is required for High Availability heartbeat pings, such as linux-ha.

Diffstat says:
 asterisk.init | 11 +++--------
 changelog | 8 ++++++++
 control | 2 +-
 3 files changed, 12 insertions(+), 9 deletions(-)

This change builds successfully on all platforms, as it's only a change to shell code. It installs and upgrades successfully, in that it's changing a conffile managed by the package.

:-Dustin

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

I have subscribed motu-release to this bug, in order to process the Feature Freeze Exception noted in my previous comment.

Thanks,
:-Dustin

Revision history for this message
StefanPotyra (sistpoty) wrote :

Hi Dustin,

up to FinalFreeze, you need a freeze exception only for (non-bugfix) new upstream versions, or if you really want to do an invasive change in an upload (e.g. like causing a transition).

Unsubscribing motu-release again, no need for an exception ;)

Cheers,
   Stefan.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package asterisk - 1:1.4.21.2~dfsg-1ubuntu3

---------------
asterisk (1:1.4.21.2~dfsg-1ubuntu3) intrepid; urgency=low

  * debian/asterisk.init: Fix status action so that it returns the
    LSB-compliant return codes (LP: #248947)
  * debian/control: added lsb-base dependency for using status_of_proc

 -- Thierry Carrez <email address hidden> Mon, 29 Sep 2008 14:21:59 +0200

Changed in asterisk:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.