Fix the init script so mcollective can be restarted properly 49/2749/1
authorAlexei Sheplyakov <asheplyakov@mirantis.com>
Thu, 29 Jan 2015 11:08:24 +0000 (14:08 +0300)
committerAlexei Sheplyakov <asheplyakov@mirantis.com>
Thu, 29 Jan 2015 11:08:42 +0000 (14:08 +0300)
The check for a running mcollective process is totally wrong and fails
to handle a stale pid file:

if [ -f $(cat /proc/$(cat $pidfile)/exe > /dev/null) ] ; then

Basically it's

if [ -f ]; then echo "Someone can't write shell scripts"; fi

This error breaks image based deployment. During the first boot after
the image based provisioning cloud init reconfigures mcollective to use
rabbitmq for communication and restarts it. However the restart gets
suppressed due to a bug in the sysv-style init script, so OpenStack
deployment does not start (and eventually times out).

The error is non-deterministic since sometimes cloud-init manages to
configure mcollective before it actually gets started (thus the correct
configuration is used despite the skipped restart).

Related-Bug: #1407634
Change-Id: I1608492ff807a1662fa1453c6e50d9fb4eb234bd

debian/changelog
debian/mcollective.init
mcollective.init [changed mode: 0644->0755]

index efbd4602156d7a80545de3295b6ac93e021403bd..33ff38ec50dfc273684077a58b70c3236479c1f6 100644 (file)
@@ -1,3 +1,10 @@
+mcollective (2.3.1~mos6.1+2) trusty; urgency=low
+
+  * Fix the sysv-style startup script so mcollective can be properly
+    restarted.
+
+ -- Alexei Sheplyakov <asheplaykov@mirantis.com>  Thu, 29 Jan 2015 13:31:58 +0300
+
 mcollective (2.3.1~mos6.1+1) trusty; urgency=low
 
   * Pick the sources from packages/precise/mcollective.
index 6b02d0b06572066b6aefa05a5db090168190e5ca..ee8d68f757a37913cdf522cb36bb4d252b65041b 100755 (executable)
@@ -46,8 +46,8 @@ case "$1" in
     start)
         echo "Starting daemon: " $name
         # start the program
-       if [ -f $pidfile ]; then
-               if [ -f $(cat /proc/$(cat $pidfile)/exe > /dev/null) ] ; then
+       if [ -f "$pidfile" ]; then
+               if [ -L "/proc/$(cat $pidfile)/exe" ] ; then
                        echo MCollective appears to be running
                        exit 1
                else
old mode 100644 (file)
new mode 100755 (executable)
index 6b02d0b..ee8d68f
@@ -46,8 +46,8 @@ case "$1" in
     start)
         echo "Starting daemon: " $name
         # start the program
-       if [ -f $pidfile ]; then
-               if [ -f $(cat /proc/$(cat $pidfile)/exe > /dev/null) ] ; then
+       if [ -f "$pidfile" ]; then
+               if [ -L "/proc/$(cat $pidfile)/exe" ] ; then
                        echo MCollective appears to be running
                        exit 1
                else