diff options
author | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-01-26 16:05:53 +0100 |
---|---|---|
committer | Sylvain Pineau <sylvain.pineau@canonical.com> | 2015-01-26 16:05:53 +0100 |
commit | ab1e4c212886fe6d109d9b7ae4a6d46f8a321ca9 (patch) | |
tree | 4038b212b933117dda6e73e90affd1312643e685 | |
parent | 6ba7755e52cdce58c54d16a9f147c4e001bfcec9 (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-x | bin/pm_test | 7 |
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): """ |