aboutsummaryrefslogtreecommitdiff
path: root/slave
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-06 07:39:28 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-06 07:39:28 +0530
commit59c6e03ea7c62406057de397a06086018075835b (patch)
treeeac53dde47e067bf34ea683578d478b63e9c9520 /slave
parentMove old autotua tmpdirs inside the chroot to /tmp/autotua-old instead of /tmp (diff)
downloadautotua-59c6e03ea7c62406057de397a06086018075835b.tar.gz
autotua-59c6e03ea7c62406057de397a06086018075835b.tar.bz2
autotua-59c6e03ea7c62406057de397a06086018075835b.zip
Just spent the better part of an hour tracing a regression that turned out to be a missing '/'
Tell me. What did I do to deserve this?
Diffstat (limited to 'slave')
-rw-r--r--slave/autotua/chroot/__init__.py9
-rwxr-xr-xslave/cleanup_on_death.py5
2 files changed, 8 insertions, 6 deletions
diff --git a/slave/autotua/chroot/__init__.py b/slave/autotua/chroot/__init__.py
index 3197176..cdc02c2 100644
--- a/slave/autotua/chroot/__init__.py
+++ b/slave/autotua/chroot/__init__.py
@@ -93,9 +93,10 @@ class WorkChroot(object):
def _clean_mounts(self):
# /proc/mounts is more reliable than mtab (which is what `mount` uses)
mounts = open('/proc/mounts', 'r').read()
- regex = re.compile(r'%s/[^ ]+' % self.chrootdir.replace(' ', r'\040'))
+ regex = re.compile(r'%s/[^ ]+' % self.chrootdir.replace(' ', r'\\040'))
for mount in regex.findall(mounts):
- subprocess.check_call('umount "%s"' % mount.replace(r'\040', ' '), shell=True)
+ mount = mount.replace(r'\040(deleted)', '').replace(r'\040', ' ')
+ subprocess.check_call('umount "%s"' % mount, shell=True)
def _bind(self, src, dest, ro=True):
"""
@@ -148,7 +149,7 @@ class WorkChroot(object):
"""
self._clean_mounts()
if osp.isdir('%s/tmp/autotua' % self.chrootdir):
- if not os.isdir('%s/tmp/aututoa-old' % self.chrootdir):
- os.makedirs('%s/tmp/aututoa-old' % self.chrootdir)
+ if not osp.isdir('%s/tmp/autotua-old' % self.chrootdir):
+ os.makedirs('%s/tmp/autotua-old' % self.chrootdir)
shutil.move('%s/tmp/autotua' % (self.chrootdir),
'%s/tmp/autotua-old/autotua-%s' % (self.chrootdir, strftime('%Y%m%d%H%M%S')))
diff --git a/slave/cleanup_on_death.py b/slave/cleanup_on_death.py
index e8f6e42..00c37ea 100755
--- a/slave/cleanup_on_death.py
+++ b/slave/cleanup_on_death.py
@@ -13,9 +13,10 @@ 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.TMPDIR.replace(' ', r'\040'))
+ regex = re.compile(r'%s/[^ ]+' % const.TMPDIR.replace(' ', r'\\040'))
for mount in regex.findall(mounts):
- subprocess.check_call('umount "%s"' % mount.replace(r'\040', ' '), shell=True)
+ mount = mount.replace(r'\040(deleted)', '').replace(r'\040', ' ')
+ subprocess.check_call('umount "%s"' % mount, shell=True)
print "ZOMG!@~: WE DIED. Cleaning up stuff..."
clean_mounts()