diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2008-07-09 11:29:59 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2008-07-09 11:29:59 +0530 |
commit | 935946ea0ed2568ce9cdc6be1e56f952db5ca6de (patch) | |
tree | 94a552a56174efa7bd401cc96aa4f79f6f9cd4bd /slave | |
parent | Fix major logic problems in autotua.sync which led to *no* syncing happening ... (diff) | |
download | autotua-935946ea0ed2568ce9cdc6be1e56f952db5ca6de.tar.gz autotua-935946ea0ed2568ce9cdc6be1e56f952db5ca6de.tar.bz2 autotua-935946ea0ed2568ce9cdc6be1e56f952db5ca6de.zip |
Cleanup after premature dying. Temporary till we haz nice exception handling.
(based on threats by armin76)
Diffstat (limited to 'slave')
-rwxr-xr-x | slave/cleanup_on_death.py | 20 | ||||
-rwxr-xr-x | slave/test_modules.sh | 12 | ||||
-rwxr-xr-x | slave/which_tests.py (renamed from slave/test_modules.py) | 0 |
3 files changed, 32 insertions, 0 deletions
diff --git a/slave/cleanup_on_death.py b/slave/cleanup_on_death.py new file mode 100755 index 0000000..feef5b1 --- /dev/null +++ b/slave/cleanup_on_death.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# vim: set sw=4 sts=4 et : +# Copyright: 2008 Gentoo Foundation +# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +# License: GPL-2 +# +# Immortal lh! +# + +from autotua import const + +def clean_mounts(): + # /proc/mounts is more reliable than mtab (which is what `mount` uses) + mounts = open('/proc/mounts', 'r').read() + regex = re.compile(r'%s/[^ ]+' % const.AUTOTUA_DIR.replace(' ', r'\\040')) + for mount in regex.findall(mounts): + subprocess.check_call('umount "%s"' % mount.replace(r'\040', ' '), shell=True) + +print "ZOMG!@~: WE DIED. Cleaning up stuff..." +clean_mounts diff --git a/slave/test_modules.sh b/slave/test_modules.sh new file mode 100755 index 0000000..e79dd29 --- /dev/null +++ b/slave/test_modules.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# vim: set sw=4 sts=4 et : +# Copyright: 2008 Gentoo Foundation +# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +# License: GPL-2 +# +# Immortal lh! +# + +WHERE="$(dirname $0)" + +"${WHERE}"/which_tests.py || "${WHERE}"/cleanup_on_death.py diff --git a/slave/test_modules.py b/slave/which_tests.py index 8b4a21e..8b4a21e 100755 --- a/slave/test_modules.py +++ b/slave/which_tests.py |