From 06419c51bc91209904bc18904eb23000ab04ddbb Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Wed, 21 Jan 2015 15:19:23 +0100 Subject: providers:checkbox: run {poweroff,reboot} in the foreground This patch changes the pm_test script to run either poweroff(8) or reboot(8) commands in the foreground and then wait indefinitely until something kills the pm_test process. This prevents LP: #1413132 from occurring by letting plainbox wait until the script finishes (which it never does). This is a stop-gap measure until noreturn flag is implemented and understood by plainbox and all appropriate jobs are patched to use it. Fixes: https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1413134 Signed-off-by: Zygmunt Krynicki --- bin/pm_test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/pm_test b/bin/pm_test index e4b8fc0..0075355 100755 --- a/bin/pm_test +++ b/bin/pm_test @@ -7,6 +7,7 @@ import re import shutil import subprocess import sys +import signal from argparse import ArgumentParser, SUPPRESS from calendar import timegm @@ -143,7 +144,11 @@ class PowerManagementOperation(object): logging.info('Executing new {0!r} operation...' .format(self.args.pm_operation)) logging.debug('Executing: {0!r}...'.format(command_str)) - subprocess.Popen(command_str, shell=True) + # The PM operation is performed asynchronously so let's just wait + # indefinitely until it happens and someone comes along to kill us. + # This addresses LP: #1413134 + subprocess.check_call(command_str, shell=True) + signal.pause() def summary(self): """ -- cgit v1.2.3