summaryrefslogtreecommitdiff
diff options
authorZygmunt Krynicki <zygmunt.krynicki@canonical.com>2015-01-21 15:19:23 +0100
committerZygmunt Krynicki <zygmunt.krynicki@canonical.com>2015-01-21 15:19:23 +0100
commit06419c51bc91209904bc18904eb23000ab04ddbb (patch)
tree232a9bef6deaa696458bbce92f16f589f3d8fd02
parent3c729bcc2c939246b0a665e5352f303093bb674a (diff)
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 <zygmunt.krynicki@canonical.com>
-rwxr-xr-xbin/pm_test7
1 files changed, 6 insertions, 1 deletions
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):
"""