Browse code

Already dead process tolerance in unstack.sh

The gate/updown.sh calls the unstack.sh with
-ex option. Normally we do not use -e with unstack.sh.

The unstack.sh can fail if the service already stopped,
and it also can have flaky failures on the gate.

For example the stop_swift function tries to kill swift in two
different ways, and if the first one succeeds before the 2th attempt
the pkill fails the whole unstack.sh.

This change accepts kill failure.
Normally the kill can fail if the process does not exits,
or when you do not have permission to the kill operation.

Since the permission issue is very unlikely in our case,
this change does not tries to distinguish the two operation.

The behavior of the unstack.sh wen you are not using -ex should
not be changed by this change.

Change-Id: I64bf3cbe1b60c96f5b271dcfb620c3d4b50de26b

Attila Fazekas authored on 2015/07/01 19:17:35
Showing 3 changed files
... ...
@@ -1342,7 +1342,7 @@ function screen_stop_service {
1342 1342
 
1343 1343
     if is_service_enabled $service; then
1344 1344
         # Clean up the screen window
1345
-        screen -S $SCREEN_NAME -p $service -X kill
1345
+        screen -S $SCREEN_NAME -p $service -X kill || true
1346 1346
     fi
1347 1347
 }
1348 1348
 
... ...
@@ -42,7 +42,7 @@ function neutron_agent_lbaas_configure_agent {
42 42
 
43 43
 function neutron_lbaas_stop {
44 44
     pids=$(ps aux | awk '/haproxy/ { print $2 }')
45
-    [ ! -z "$pids" ] && sudo kill $pids
45
+    [ ! -z "$pids" ] && sudo kill $pids || true
46 46
 }
47 47
 
48 48
 # Restore xtrace
... ...
@@ -772,7 +772,7 @@ function stop_swift {
772 772
         stop_process s-${type}
773 773
     done
774 774
     # Blast out any stragglers
775
-    pkill -f swift-
775
+    pkill -f swift- || true
776 776
 }
777 777
 
778 778
 function swift_configure_tempurls {